This example shows you how to use RPN in a more complicated setting. The following formula calculates the payments to a lease that has advance payments. It shows how the stack and register can be used. The formula is from the HP-41C User's Library Solutions: Lending, Saving and Leasing, page 39 (out of print).
PMT = (PV Resid*(1+i)^-n) / ((1 (1+i)^-(n-A))/i + A)
PMT is the value of each payment; PV is the Present Value amount of the lease; Resid is the Residual value at the end of the lease; n is the total number of periods in the lease; i is the periodic interest rate; and A is the number of advance payments.
The best way to deal with such a complicated formula from HP Calc's Arithmetic function is to start from the innermost parentheses, perform any computations, and work your way outward. In general, key in a number and press the appropriate arithmetic key if there is an arithmetic operation. Otherwise press (ENTER) and key in the next number. Repeat this process until the problem is solved.
As an example, let's solve the above equation for PMT, given the following values: PV = $30,000, Resid = $5,000, n = 60, A = 3, and annual interest rate = 13% (monthly rate = 0.13/12). Open the HP Calc application and activate the Arithmetic window. Make sure you are set to RPN mode. Press (MENU) Option Modes RPN (F10) on the 100LX or (MENU) Option Alg/RPN on the 95LX. The letters RPN should appear in the lower left corner of the display.
If the stack and registers are not visible, press (F2) (SHOW) on the 95LX or press (MENU), Options, Calculator Modes, (ALT)-(T) (Show Stack) and (ALT)-(E) (Show Registers) on the 100LX.
Clear the stack and the registers. On the 95LX press: (MENU) Erase Registers; and (MENU) Erase Stack. On the 100LX press: (MENU) Clear Stack; and (MENU) Clear Registers. Then store the above values in registers 0 through 4 by keying in the following:
0.13 (STO) 0
60 (STO) 1
5000 (STO) 2
30000 (STO) 3
3 (STO) 4
Clear the stacks again as described above.
Before keying in the set of keystrokes listed below, pick an empty System Macro key and start recording a macro. (For example, to record a macro and assign it to function key F5, press (<Shift>)-(Fn) (F5) to start recording and to (<Shift>)-(Fn) (F5) to end recording.) For more on recording and editing macros, see Chapter 6 in the old HP 100LX User's Guide, Chapter 20 in the newer HP 100LX User's Guide, or 21-14 through 21-19 in HP 95LX User's Guide.
Only enter the keystrokes to the left. Comments in parentheses are for clarification and should not be entered. The corresponding Stack Values listed below will be displayed when you press the keystrokes. Remember, the stack x value is displayed on the Calc line, bottom right below the thick horizontal line.
Keystrokes Stack Values
(Comments)
X Y Z T
1 (ENTER) 1 0 0 0
(RCL) 0 0.13 1 0 0
12 12 0.13 1 0
(Number of periods per year)
(/) 0.01 1 0 0
(The contents of Y are divided by X and the results placed in X.)
(STO) 5 0.01 1 0 0
(Save periodic interest rate in register 5, so we don't have to divide by 12 each time we use Register 0.)
(+) 1.01 0 0 0
(RCL) 1 60 1.01 0 0
(+/-) -60 1.01 0 0
(Change the sign of X.)
(^) 0.52 0 0 0
(Raise Y to the power of X.)
(RCL) 2 5,000 0.52 0 0
(*) 2,619.37 0 0 0
(Multiply X and Y: put the result in X.)
(RCL) 3 30,000 2,619.37 0 0
(Get the lease amount.)
(X<>Y) 2,619.37 30,000 0 0
(Swap X and Y.)
(-) 27,380.63 0 0 0
(Subtract X from Y.)
1 1 27,380.63 0 0
(RCL) 5 0.01 1 27,380.63 0
(Recall periodic rate.)
(+) 1.01 27,380.63 0 0
(Add this to 1.)
(RCL) 1 60 1.01 27,380.63 0
(Recall the total number of periods.)
(RCL) 4 3 60 1.01 27,380.63
(-) 57 1.01 27,380.63 27,380.63
(NOTE: T is duplicated.)
(+/-) -57 1.01 27,380.63 27,380.63
(Change the sign of X.)
(^) 0.54 27,380.63 27,380.63 27,380.63
(Raise Y to the power of X.)
1 1 0.54 27,380.63 27,380.63
(X<>Y) 0.54 1 27,380.63 27,380.63
(-) 0.46 27,380.63 27,380.63 27,380.63
(Subtract.)
(RCL) 5 0.01 0.46 27,380.63 27,380.63
(/) 42.36 27,380.63 27,380.63 27,380.63
(RCL) 4 3 42.36 27,380.63 27,380.63
(+) 45.36 27,380.63 27,380.63 27,380.63
(/) 603.61 27,380.63 27,380.63 27,380.63
(The periodic payment is $603.61, listed in Stack X.)
Be sure to turn off macro recording when you've finished.
The above approach determines the period payment (PMT) only. You could solve for the other variables in a similar fashion. Of course, HP Calc's Solver application simplifies the process even further by letting you enter a formula and select the variable for which you want to solve.