Post Reply 
(32S) Accurate TVM with direct solutions
05-17-2015, 12:55 AM
Post: #1
(32S) Accurate TVM with direct solutions
Total size: 183 bytes

This TVM solver uses direct solutions to compute n, PV, PMT, and FV. Solutions for i% must be obtained using the built-in numeric solver. The multiple direct solutions account for its size, although common expressions have been moved to subroutines where possible. Results are obtained very quickly by using direct solutions.

Most of the math in this program is based on discussion in this thread.

Usage
Store values in appropriate registers:
N - n (Number of periods)
I - i% (Periodic interest rate, NOT i%/yr)
P - PV (Present value)
M - PMT (Payment)
F - FV (Future value)

Set flag 0 for begin period payments, or clear for end period payments.

Execute the desired routine to compute the remaining variable:
XEQ N - Compute n
XEQ I - Compute i% (Periodic interest rate, NOT i%/yr)
XEQ P - Compute PV
XEQ M - Compute PMT
XEQ F - Compute FV

Use XEQ V to view/input the TVM variables interactively. Press R/S to cycle through variables. Omit this label if you don't need this feature, and wish to use STO/VIEW directly.

Example:
31536000 STO N
10 RCL N / STO I
0 STO P
0.01 CHS STO M
CF 0
XEQ F

Result: 331,667.006689

Code:
V01 LBL V - 010.5, 5FF1
V02 INPUT N
V03 INPUT I
V04 INPUT P
V05 INPUT M
V06 INPUT F
V07 GOTO V

N01 LBL N - 022.5, 72C8
N02 XEQ D
N03 RCL* M
N04 RCL+ P
N05 1/x
N06 RCL P
N07 RCL+ F
N08 +/-
N09 *
N10 XEQ L
N11 XEQ C
N12 XEQ L
N13 /
N14 STO N
N15 RTN

I01 LBL I - 006.0, 277C
I02 FN= Q
I03 SOLVE I
I04 RTN

P01 LBL P - 016.5, A973
P02 XEQ K
P03 RCL* M
P04 XEQ D
P05 *
P06 RCL+ F
P07 XEQ J
P08 /
P09 +/-
P10 STO P
P11 RTN

M01 LBL M - 016.5, C07D
M02 XEQ J
M03 RCL* P
M04 RCL+ F
M05 XEQ K
M06 XEQ D
M07 *
M08 /
M09 +/-
M10 STO M
M11 RTN

F01 LBL F - 016.5, B348
F02 XEQ K
F03 RCL* M
F04 XEQ D
F05 *
F06 XEQ J
F07 RCL* P
F08 +
F09 +/-
F10 STO F
F11 RTN

C01 LBL C - 009.0, B7DD
C02 RCL I
C03 2
C04 10^x
C05 /
C06 RTN

D01 LBL D - 009.0, 494A
D02 XEQ C
D03 1/x
D04 XEQ B
D05 +
D06 RTN

B01 LBL B - 007.5, 8973
B02 0
B03 FS? 0
B04 10^x
B05 RTN

L01 LBL L - 022.5, FA05
L02 ENTER
L03 ENTER
L04 1
L05 +
L06 LN
L07 x<>y
L08 *
L09 LASTx
L10 1
L11 +
L12 1
L13 -
L14 /
L15 RTN

J01 LBL J - 009.0, B0C2
J02 XEQ C
J03 XEQ L
J04 RCL* N
J05 e^x
J06 RTN

K01 LBL K - 021.0, 8759
K02 XEQ C
K03 XEQ L
K04 RCL* N
K05 2
K06 /
K07 STO T
K08 e^x
K09 2
K10 *
K11 RCL T
K12 SINH
K13 *
K14 RTN

Q01 LBL Q - 016.5, F432
Q02 INPUT I
Q03 XEQ D
Q04 XEQ K
Q05 *
Q06 RCL* M
Q07 XEQ J
Q08 RCL* P
Q09 +
Q10 RCL+ F
Q11 RTN
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(32S) Accurate TVM with direct solutions - Dave Britten - 05-17-2015 12:55 AM
HP 35s - TVM from Gene Wright - PedroLeiva - 12-03-2015, 12:39 PM



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