(29C) Accurate TVM for HP-19C/HP-29C
01-19-2014, 07:04 PM (This post was last modified: 12-28-2015 02:38 PM by Jeff_Kearns.)
Post: #1
 Jeff_Kearns Member Posts: 147 Joined: Dec 2013
(29C) Accurate TVM for HP-19C/HP-29C
The HP-29C does not have the HP SOLVE functionality of later models starting with the HP-34C and implemented in the HP-15C, HP-41 Advantage module. This program combines the Equation Solver for the HP-19C/HP-29C published by Stefan Vorkoetter in the old software library with the accurate TVM code used in the HP-34C program, which does not have Recall Arithmetic, into a 71 line program effectively turning your HP-29C into a reliable financial calculator (insofar as standard TVM calculations are concerned).

Code:

01      g LBL 0         -main entry point
02      STO 0           -store index of variable to solve for
03      roll dn
04      STO .2          -store second guess
05      roll dn
06      STO .1          -store first guess
07      STO i           -compute f1 = f(R1,..,Ri1,..,Rn)
08      GSB 9
09      STO .0
10      RCL .2          -compute f2 = f(R1,..,Ri2,..,Rn)
11      STO i
12      g LBL 1
13      GSB 9           -the equation to be solved must begin at LBL 9
14      STO .2
15      RCL .1          -compute Ri2 <- (Ri1 f2 - Ri2 f1) / (f2 - f1)
16      x
17      RCL i
18      STO .1          -move old Ri2 to Ri1 while we're here
19      RCL .0
20      x
21      -
22      RCL .0
23      RCL .2
24      STO .0          -move old f2 to f1 while we're here
25      x<>y
26      -
27      /
28      STO i            -save new value for Ri2
29      RCL .1           -compare to previous guess
30      X≠Y              -keep going until they're the same
31      GTO 1
32      g RTN            -end of SOLVER routine that can be used with any MISO equation
33      g LBL 9          -begin entering TVM equation at this step
34      RCL 2
35      EEX
36      2
37      ÷
38      ENTER
39      ENTER
40      1
41      +
42      LN
43      X<>Y
44      LSTx
45      1
46      X≠Y
47      -
48      ÷
49      *
50      RCL 1
51      *
52      e^x
53      RCL 3
54      X<>Y
55      *
56      LSTx
57      1
58      -
59      RCL 4
60      *
61      EEX
62      2
63      RCL 2
64      ÷
65      RCL 6
66      +
67      *
68      +
69      RCL 5
70      +
71      RTN

Usage instructions:

1. Store 4 of the following 5 variables as follows, using appropriate cash flow conventions:

N STO 1 --- Number of compounding periods
I STO 2 --- Interest rate (periodic) expressed as a %
B STO 3 --- Initial Balance or Present Value
P STO 4 --- Periodic Payment
F STO 5 --- Future Value
and store the appropriate value (1 for Annuity Due or 0 for Regular Annuity) as
B/E STO 6 --- Begin/End Mode. The default is 0 for regular annuity or End Mode.

2. Leave the floating variable un-stored, but enter two guesses (if desired), each followed by the ENTER key; and

3. Enter the floating variable register number followed by GSB 0

Example from the HP-15C Advanced Functions Handbook-

"Many Pennies:

A corporation retains Susan as a scientific and engineering consultant at a fee of one penny per second for her thoughts, paid every second of every day for a year.
Rather than distract her with the sounds of pennies dropping, the corporation proposes to deposit them for her into a bank account in which interest accrues at the rate of 11.25 percent per annum compounded every second. At year's end these pennies will accumulate to a sum

total = (payment) X ((1+i/n)^n-1)/(i/n)

where payment = $0.01 = one penny per second, i = 0.1125 = 11.25 percent per annum interest rate, n = 60 X 60 X 24 X 365 = number of seconds in a year. Using her HP-15C, Susan reckons that the total will be$376,877.67. But at year's end the bank account is found to hold $333,783.35 . Is Susan entitled to the$43,094.32 difference?"

31,536,000 STO 1
(11.25/31,536,000) STO 2
0 STO 3
-0.01 STO 4

5 GSB 0

The HP-29C gives the correct result: \$333,783.35.
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)