The following warnings occurred:
Warning [2] Undefined array key 240852 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.15 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 240864 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.15 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 240915 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.15 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 240918 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.15 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 240920 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.15 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 240923 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.15 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 240929 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.15 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $thread - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.15 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.15 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $fid - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.15 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 240923 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.15 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 240929 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.15 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $theme - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.15 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.15 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $theme - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.15 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.15 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $lang - Line: 5 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.15 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 5 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Attempt to read property "messages_in_thread" on null - Line: 5 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.15 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 5 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks





HP 39gii Tutorial: REPEAT and WHILE



#7

http://edspi31415.blogspot.com/2013/03/hp-39gii-programming-part-4-repeat-and.html?m=1


#8

Hi Eddie

here is an improved version of your SQFACTOR program :

EXPORT SQFACTOR(N)
BEGIN
LOCAL C,K,S;
C:=1;
K:=FLOOR(VN); // V for square root symbol
WHILE K > 1 DO
WHILE FRAC(N/K²) == 0 DO
N:=N/K²;
C:=C*K;
END;
K:=K-1;
END;
S:="";
IF C<>1 THEN S:=string(C);END;
IF N<>1 THEN S:=S+"V"+string(N); END;
RETURN S;
END;

So SQFACTOR(400) returns "20" and not "4 &#8730; 25"


Edited: 19 Mar 2013, 7:26 a.m.


#9

Thanks Giles! I am going to test this out


#10

Here is an interesting program by C.RET posted on silicium.org


EXPORT RAC(X)
BEGIN
LOCAL F:=SIGN(X), R:=ABS(X);
LOCAL I:=1,Txt:="V("+X+")=";

REPEAT
IF R MOD I*I
THEN I:=I-1;
ELSE F:=F*I; R:=R/I/I; I:=FLOOR(VR);
END;
UNTIL I<2;

IF (ABS(F)<>1) OR (R=F) THEN Txt:=Txt+ABS(F) END;
IF F<0 THEN Txt:=Txt+" i " END;
IF R<>1 THEN Txt:=Txt+"V"+R END;
RETURN Txt;
END;

Change V by square root symbol
it works also with negative numbers :


#11

I did not know we could initialize and localize variables in one step. This will make things more efficient.

Gilles, is it OK if I post your program in my next blog entry? Credit will be given.

Eddie


#12

Hi Eddie, this program is not by me, but by C.RET.

#13

Eddie you are welcome.

No problem at all, I consider this code has already fallen into the public domain since I posted it this public forum. It was the result of a kid of brain storm threat. Several people were involved in the discussion. Gilles is one of them.

Please feel free to publish it, as soon as you are kind enough to indicate references of the peoples and the Silicium.org forum.

www.silicium.org/forum
[hp39gII] Simplificateur de racines carrées
([hp39gii] A Square Roots Simplicator)

The HP-39gii is really an amazing system. Every day, we discover new capabilities; the localization and initialization in one shot is one of its numerous features.

The Silicium.org forum is really active, we already analyze this first version of the code and turn it into two new versions :

EXPORT RAC(X)
BEGIN
LOCAL F:=SIGN(X), R:=ABS(X);
LOCAL I:=1,Txt:="¡Ì("+X+")=";

REPEAT
IF R MOD I*I
THEN I:=prevprime(I);
ELSE F:=F*I; R:=R/I/I; I:=FLOOR(¡ÌR);
END;
UNTIL Q<2;

IF (ABS(F)<>1) OR (R=F) THEN Txt:=Txt+ABS(F) END;
IF F<0 THEN Txt:=Txt+" i " END;
IF R<>1 THEN Txt:=Txt+" \V"+R END;
RETURN Txt;
END;

The only change is prevprime(I) replacing I:=I-1; expecting speed-up with large numbers.

The last version, is quite more different, it is using the built-in function ifactors that returns the list of prime factors (and multiplicity). This last version has the shortest/fastest look-up loop !

EXPORT RAC( X )
BEGIN
LOCAL F:=SIGN(X),R:=ABS(X);
LOCAL p,I,T:="¡Ì("+X+")=";

LOCAL LF:=ifactors(R);

FOR p FROM 2 TO SIZE(LF) STEP 2 DO
I:=LF(p-1)^FLOOR(LF(p)/2);
F:=F*I; R:=R/I/I;
END;

IF (ABS(F)<>1) OR (R=F) THEN T:=T+ABS(F) END;
IF F<0 THEN T:=T+" i " END;
IF R<>1 THEN T:=T+" \V"+R END;
RETURN T;
END;


Edited: 20 Mar 2013, 6:40 p.m.


Possibly Related Threads…
Thread Author Replies Views Last Post
  HP Prime Tutorial #6 and #7: Drawing Eddie W. Shore 2 1,870 12-10-2013, 08:16 AM
Last Post: Eddie W. Shore
  Gathering USB dumps for Connectivity Kit <-> 39gII communication... debrouxl 2 1,636 12-01-2013, 12:59 PM
Last Post: Marcus von Cube, Germany
  New firmware for HP 39gII Mic 6 2,787 11-26-2013, 06:23 PM
Last Post: DeboT
  HP Prime Tutorial #4 is up (CASE/CHOOSE/INPUT) Eddie W. Shore 1 1,285 11-15-2013, 07:32 AM
Last Post: Davi Ribeiro de Oliveira
  HP Prime Programming Tutorial #3: WHILE, INPUT, KILL, REPEAT, GETKEY Eddie W. Shore 5 2,328 11-07-2013, 12:25 AM
Last Post: Han
  HP Prime Programming Tutorial #1: LOCAL, RETURN Eddie W. Shore 6 2,971 10-26-2013, 08:42 PM
Last Post: Miguel Toro
  HP Prime Programming Tutorial #2: MSGBOX, IF-THEN-ELSE, PRINT, FOR Eddie W. Shore 0 1,236 10-26-2013, 03:51 PM
Last Post: Eddie W. Shore
  HP Prime vs. 39gII Connectivity Kit Marcus von Cube, Germany 3 1,712 10-09-2013, 05:44 PM
Last Post: Marcus von Cube, Germany
  [HP 39Gii] - Bug report Jean-Michel 1 1,596 08-28-2013, 10:53 AM
Last Post: Tim Wessman
  hp 39gii lcd clear question giancarlo 7 2,650 08-18-2013, 07:30 AM
Last Post: Mic

Forum Jump: