Programming HP 50G with SysRPL
Most of the programming in HP 50g are done in SysRPL language, a reverse polish notation language
with features for handling
list and objects. In this blog we start with our first example program: compute the area of a
circle which is given by . Our calc will expect the value of the radius to be on the stack.
- Set the calculator to RPN mode if it is in Algebraic mode. If it is,
Press in sequence. Otherwise go to Step 2.
- Press for "<<>>"" The last key is found in the last column of the second row.
Your calc will now be in program mode with a matched pair
of "<<" and ">>" shown. Now type in the following after the opening "<<":
<< x^2 RS . LS SPC RS . * RS . RS ->NUM >>
The "RS ." combination inserts a carriage return. The Left shift SPC combination represents the constant.
The "RS ->NUM" combination converts the answer to numeric value.
- Press ENTER key. Immediately the display screen will output << SQ \pi * ->NUM >>.
This small program is pushed to the stack
and will be at level 1.
- Save and give a name to your program.
Enter the string CAREA enclosed in single quotes then press the STO key.
Now your program is stored in variable named CAREA.
Press the VAR key and your program should be displayed in the soft menu as CAREA.
- Test your program.
Enter value of 3, then press the softkey assigned to CAREA (In my calc, it is assigned to F1.)You may hve to press NXT key
if you have lots of variables.
If you see the value 28.2743338823, congratulations! you are on the right track.
Otherwise you may have to edit your program and save the changes back (To be explained in a future post).
Programming in algebraic mode with DEFINE.
Simple functions can be programmed in algebraic mode.
Our circle area for example may be entered in algebraic mode
DEFINE(AREA(x)= SQ(x) * 3.14159265359)
We have to type in the actual value of pi since the ->NUM command does not work inside user defined programs with DEFINE.you dont have to type in the letters D E F I N E But rather press LS 2 (for DEF) when you create simple functions. Don't forget the closing parenthesis and press the ENTER key. A variable will then be automatically created taking its name from the the name of your function
Whan you have to use it, you recall its name either by typing its name
or pressing the softkey assigned to the variable and then the argument enclosed in parenthesis.
It is a bother entering parentheses and that's why rpn is a natural fit with calculators.
Moreover the program you created in rpn mode can also be used in algebraic mode! For example
the previous CAREA rpn function may be called with an argument as in CAREA(3). Clever chaps at HP!
Having the best of both worlds, algebraic formulas inside RPL programs
In rpn mode, once can edit and do the following:
<< -> r '3.14159265 * r^2' >>
The keystokes "-> r" pops the topmost stack value and store it into the local variable r.
a formula with algebraic syntax may be inserted inside RPL programs by enclosing them in quotes.