Friday, September 2, 2016

TI-84 Plus CE: Basic RPN

TI-84 Plus CE:  Basic RPN

The program TI84RPN puts the TI-84 Plus CE into RPN (reverse polish notation) mode with arithmetic functions, power, square root, reciprocal, and π.  The program contains room for one independent memory and a four level stack that works like the classic Hewlett Packard RPN calculators. 




The program uses list 6 (L6) as the stack, with six elements:
L6(1): X stack (display)
L6(2): Y stack
L6(3): Z stack
L6(4): T stack
L6(5): Independent memory stack
L6(6): (temporary memory)

If you need an idea how RPN works, please check this out:  http://edspi31415.blogspot.com/2011/09/rpn-basics.html

To enter numbers, this program requires you to press the [enter] key prior to entering a number on the stack.  

The following keys with the associated functions are available:

[ enter ]  Enter number
[ + ] Add: Y + X
[ - ] Subtract: Y - X
[ × ] Multiplication: Y * X 
[ ÷ ] Divide: Y/X
[ ^ ]  Exponent: Y^X
[ x2 ] Square:  x^2
[ x-1 ]  Reciprocal:  1/x
[ , ]  Square Root √X
[ XTθN ] Enter π to the stack 
[ sto> ] Store X in independent memory
[ alpha ] Recall memory 
[ clear ] Clear X stack to 0

Stack operations:
[ ( ] Swap with X and Y
[ ) ] Roll stack down, result { Y, T, Z, X }

Exit the program: press [ exit ]

Example:   2 + 3 + 9 = 14
Keys:
[ enter ], 2, [ enter ]
[ enter ], 3, [ enter ], [ + ], 
[ enter ], 9,  [ enter ], [ + ]

TI-84 Plus CE Program:  TI84RPN  (889 bytes)
Disp "TI-84+ BASIC RPN"
Disp "EWS SEPT. 2016"
Full
{0,0,0,0,0,0}→L
ClrHome
Lbl 1
getKey→K
Output(3,1,L(1))
Output(4,1,"(: SWAP, ): ROLL")
Output(5,1,"MODE: EXIT, ALPHA: RCL")
Output(6,1,", √(   XTθN: π")
Output(7,1,"ENTER: ENTER NUMBER")
If K=45:Then:0→L(1):ClrHome:End
If K=55:Then:L(2)^L(1)→L(6)
Goto 2:End
If K=65:Then:L(2)/L(1)→L(6)
Goto 2:End
If K=75:Then:L(2)*L(1)→L(6)
Goto 2:End
If K=85:Then:L(2)-L(1)→L(6)
Goto 2:End
If K=95:Then:L(2)+L(1)→L(6)
Goto 2:End
If K=105:Then:Goto 4:End
If K=51:Then:1/L(1)→L(1):ClrHome:Goto 1:End
If K=61:Then:L(1)²→L(1):ClrHome:Goto 1:End
If K=63:Then:Goto 5:End
If K=64:Then:Goto 6:End
If K=91:Then:L(1)→L(5):Goto 1:End
If K=31:Then:L(5)→L(6):Goto 3:End
If K=62:Then:√(L(1))→L(1):ClrHome:Goto 1:End
If K=32:Then:π→L(6):Goto 3:End
If K=22:Then:ClrHome:Stop:End
Goto 1
Lbl 2
"TWO OPERATION"
L(6)→L(1):L(3)→L(2):L(4)→L(3)
ClrHome
Goto 1
Lbl 3
"PI/RCL/INPUT"
L(3)→L(4):L(2)→L(3):L(1)→L(2)
L(6)→L(1):ClrHome
Goto 1
Lbl 4
"INPUT NUMBER"
ClrHome
Input "NUMBER:",N
N→L(6)
Goto 3
Lbl 5
"SWAP"
L(1)→L(6):L(2)→L(1):L(6)→L(2)
ClrHome
Goto 1
Lbl 6
"ROLL"
L(1)→L(6)
L(2)→L(1):L(3)→L(2):L(4)→L(3)
L(6)→L(4)
ClrHome
Goto 1


Remember to keep the Order of Operations in mind when running this program.

Example 1:   1/(10 – 1.5^2.5) = 0.1380391041

[ enter ], 10, [ enter ]
[ enter ], 1.5, [ enter ]
[ enter ], 2.5, [ enter ]
[ ^ ], [ - ], [ x-1 ]


Example 2:   √(6^2 + 7^2) = 9.219544457

[ enter ], 6, [ enter ], [ x2 ]
[ enter ], 7, [ enter ], [ x2 ]
[ + ], [ , ]


Example 3:  Store 1.758 in memory. (Let M = 1.758)
Calculate 10 – 1.1^M + 2M = 12.33358933

[ enter ], 1.758, [ enter ], [ sto> ]
[ enter ], 10, [ enter ]
[ enter ], 1.1, [ enter ]
[ alpha ], [ ^ ], [ - ]
[ enter ], 2, [ enter ]
[ alpha ], [ × ], [ + ]

Example 4:  (10 + (8 – 5%)) + 9% = (10 + (8 * .95)) * 1.09 = 19.184

[ enter ], 8, [ enter ]
[ enter ], .95, [ enter ], [ × ]
[ enter ], 10, [ enter ], [ + ]
[ enter ], 1.09, [ enter ], [ × ]

This blog is property of Edward Shore, 2016




No comments:

Post a Comment

Retro Review: Garrett CM 20 Calculator

Retro Review:   Garrett CM 20 Calculator   Introduction Is it Pac Man or is it a calculator? I bet if Pac Man and Ms. ...