HP Forums

Full Version: (12C) Mortgage Loan Interest Rate
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This program was modify and adapted to work for the HP-12C from
HP-33E Applications Book on Page 37

As state in this book program will calculate the interest rate on a loan
with equal periodic payments. The user must specify the number of period,
the present value or initial loan amount, and the payment amount.

The program performs an iterative solution for [i] using Newton's method.

Usually this type of problem can be solve easily with the HP-12C but I found
that this program run faster than the Original HP-12C when solve for "Interest Rate"

So this program is use to try out the computation speed between the build-in TVM
functions and the custom program.
-----------------------------------------------------------------
Example Problem:
n = 36
PV = 3600
PMT = -360
Interest Rate = ?

[f] 2
36 [n]
3600 [PV]
360 [CHS] [PMT]
[i] ...... about 17 second display 9.64

To use program: same data as previous problem
press [R/S]....... about 12 second display 9.64
----------------------------------------------------------------
Program:
Code:

01 RCL [n]
02 STO 1
03 RCL [PV]
04 RCL [PMT]
05  ÷
06 STO 3
07  0
08 X<>Y
09 X≤Y
10 CHS
11 ENTER
12 1/x
13 X<>Y
14 RCL 1
15 ENTER
16  x
17  ÷
18  -
19 STO 2
20 RCL 3
21 0
22 X<>Y
23 X≤Y
24 CHS
25 RCL 2
26  x
27  1
28 RCL 2
29  1
30  +
31 RCL 1
32 CHS
33 Y^X
34 STO 5
35  -
36  -
37 RCL 1
38 RCL 2
39 1/x
40  1
41  +
42  ÷
43  1
44  +
45 RCL 5
46  x
47  1
48   -
49 RCL 2
50  ÷
51  ÷
52 STO+2
53  0
54 X<>Y
55 X≤Y
56 CHS
57 EEX
58  6
59 CHS
60 X≤Y
61 GTO 20
62 RCL 2
63 EEX
64  2
65  x

Remark:
This program speed don't make noticeable different on the HP-12C+

I think the reason that this program run faster might be how this program use
the initial guess (The guess migh be very close to the solution than the HP-12C TVM algorithm)


Gamo 6/2021
(06-15-2021 07:45 AM)Gamo Wrote: [ -> ][f] 2
36 [n]
3600 [PV]
360 [CHS] [PMT]
[i] ...... about 17 second display 9.64

To use program: same data as previous problem
press [R/S]....... about 12 second display 9.64

It seems HP12C use whatever was stored in [i] as guess.
If we provide same guess of program for HP12C TVM:

(-PMT/PV) - (-PV/PMT)/N² ≈ 1/10 - 10/36² ≈ 9.23%

9.23 [i] [i] ... finished in 10 second

Solve again, with true rate as guess

[i] [i] ... finished in 4 second

With 5% guess, and interrrupt rate search, we get this:

5 [i] [i] [On] [On]    → 8.99
   [i] [i] [On] [On]    → 9.62
   [i] [i] [On] [On]    → 9.64
According to this book state that

The initial guess for [i] is given by

i₀ = |PMT ÷ PV| - (1 ÷ n²) |PV ÷ PMT|


Gamo
Timing suggested solving for i is using IRR routine.

Clear Reg
3600 CF0       ; PV
360 CHS CFj  ; PMT
36 Nj            ; N
IRR               ; 9.635443543 (17 sec)

9.23 [i] RCL [g] [R/S] ; guess = (-PMT/PV) - (-PV/PMT)/N^2 (10 sec)
       [i] RCL [g] [R/S] ; guess = true rate (4 sec)
Reference URL's