Named programs with variables
Write a program with a text name and a variable, store a value and run it.
The RPN Advanced 42 lets you give programs readable names, and use named variables instead of just the stack. Letters are typed in ALPHA mode: you press a group key (like F-I) and then a letter inside it.
We build FX: it reads a variable X, squares it and subtracts 2. The MVAR line marks X as an input, which also lets the solver use the program.
RPN Advanced 42
Start on the main screen: Press EXIT (once or twice) to close any menu and return to the plain stack view of Y and X.
Press shift, then R/S (PRGM) to start recording.
⇧PRGMR/SAdd the label: PGM.FCN (shift, 3), pick LBL, then type the name FX. Each letter is two presses (its group, then the letter). Press ENTER to finish.
⇧PGM.FCN3Σ+⇧ALPHAENTER1/xΣ+XEQ1/xENTERDeclare the input: PGM.FCN, press down twice for the second page, pick MVAR, and type X.
⇧PGM.FCN3▼▼Σ+XEQ1/xENTERRecall X and calculate: RCL, name X, then shift and the x² key, then 2 and minus.
RCL⇧ALPHAENTERXEQ1/xENTER⇧x²√x2−End with RTN (PGM.FCN, second menu key), then leave program mode.
⇧PGM.FCN31/x⇧PRGMR/SEXITEXITStore 3 in X, then run the program from the XEQ label menu with the first menu key.
3STO⇧ALPHAENTERXEQ1/xENTERXEQΣ+
You should see3 squared minus 2 is 7.
Tips
- If you mistype a letter, press the backspace key (←) once and type it again.
- XEQ with a typed name also works: XEQ, ALPHA, name, ENTER.