The Museum of HP Calculators

HP Forum Archive 21

[ Return to Index | Top of Index ]

For Those Who Have a HP 39gII
Message #1 Posted by Eddie W. Shore on 31 July 2012, 10:56 p.m.

Have you tried the programming on the 39gII? Thoughts? Opinions? Thanks,

Eddie

      
Re: For Those Who Have a HP 39gII
Message #2 Posted by Gilles Carpentier on 1 Aug 2012, 11:56 a.m.,
in response to message #1 by Eddie W. Shore

Hi Eddy,

I tried programming the 39gII, here some elements :

I like :

1- The language is very classic and very powerfull. It is completely integrated in the operating system. It seems a mix between Pascal, C. You can use local or globals functions and variables, you can pass parameters as integer,reals, imaginary numbers, strings, lists, matrix, you can create easily new globals variables or constants... Compare with the Pascal (the old ones, not the object versions), it miss essentially the possibility to create your own type of datas and the pointers possibilities (and the risks of crash with them !). You win list, and list processing possibilities , and dynamic data typing. It s far more powerfull that the old Basics computer

For example here is a program to calculate the square root of a matrix ( given matrix A, find M wher M*M=A

EXPORT MatSqr(m)            // Input : m, a matrix
 BEGIN
  LOCAL p,d,s,i;
  p:=EIGENVV(m);            // return a list of 2 matrix 1/ Eigen vectors  2/Eigen values )
  d:=p(2);  s:=SIZE(d);     //We have to calculate the square root for each Eigen Value (on the diagonal)
  FOR i FROM 1 TO s(1) DO   //For all elements of the diag of the matrix
     d(i,i):=√(d(i,i));     //Square root
  END
  RETURN p(1)*d*p(1)^-1;    // result is P*d*P^-1 (char for 1/x on the 39GII)
 END

2- it goes very quick !

EXPORT Box(N)
 BEGIN
  FOR I FROM 1 TO N DO
   RECT_P( FLOOR(RANDOM(255);FLOOR(RANDOM(126);
           FLOOR(RANDOM(255);FLOOR(RANDOM(126);
           0;FLOOR(RANDOM(3)));
  END;
  FREEZE;
 END

Box(n) draws n random size boxes with dark border and random grey level inside. BOX(100) is immediate
BOX(1000) takes less than 2 sec.

FOR x FROM 0 TO 255 DO
 FOR y FROM 0 TO 126 DO
   PIXON_P(x,y);
 END;
END;

take 3sec , 10.000 pixels/second

3- Lots of graphic commands, includes 'graphic bloc' manipulation

4. Keyboard management (GETKEY etc.). + speed + graphic resolution => easy to write games

5- "Apps" to customize applications

6- Of course you can use list processing in a program

7- Powerfull strings manipulation commands

I like less :

1/ Some bugs. But new versions must and will arrive.

2/ No CAS nor symbolic manipulation possibilities (but you can transform a string to a 'function' and vice versa, you can evaluate a string "3+SIN(A)/B"

3/ The language is verbose. Why not << >> instead of BEGIN END (I like { } for lists ) ? Can be a problem with a small screen and keyboard (even if you have 'skeletons' for some programming structurs

4/ Strictly 'imperative' language on the contrary of 50G RPL (in RPL you can pass program as argument, you can decide to delay the 'EVALuation' of a program, a program can easily create a program ...)

5/ Programs takes a lot a memory compare to the 50G... It' logic when you knows that the cals uses UNICOD characters and store the program both in text + exe mode... Perhaps we could delete the 'text' in the future (if we have a copy on a PC for example..)

I think that the programming possibilities are a major point of the 39gII.

Edited: 1 Aug 2012, 12:07 p.m.


[ Return to Index | Top of Index ]

Go back to the main exhibit hall