The Museum of HP Calculators

HP Articles Forum

[Return to the Index ]
[ Previous | Next ]


Simple TVM Routines for HP-15C

Posted by Chris McCormack on 16 Sept 2011, 8:46 a.m.

HP-15C - Simple Time Value of Money


Chris McCormack - 21 Oct 2007

Background
The underlying routine here caluculates the present value annuity (PVAF) based on the number of periods and the interest rate per period. Multiplying the payment by PVAF gives the total loan amount, while dividing the loan by the PVAF gives the payment size.
I've had this program sitting in my HP15C for a long time now. I've also used close relatives on the HP11C and HP33S. Not as fancy as some of the TVM programs people use, but nice to have ready when trying to talk turkey at a car dealership!

Description
These routine perform loan calculations using the present value annuity factor, or PVAF. This relates the present value (loan amount) to the periodic payments necessary to pay it off.

PVAF(r,N) = (1/r)[1-1/(1+r)^N]

In this equation, r is the decimal interest per payment period (.01 would represent a monthly loan with a 12% rate) and N is the number of payments (48 would correspond to a four-year car loan).
Note - Labels 9 and 6 were used because 9 is next to the divide key (breaking the loan down into payments) and 6 is next to the multiply key (building up the total loan amount).

001 LBL 9 // ( LoanAmt -- Payment ) 002 GSB .9 / // divide present value by PVAF 004 RTN

005 LBL 6 // ( Payment -- LoanAmt ) 006 GSB .9 * // multiply payment by PVAF 008 RTN

009 LBL .9 // ( -- PFAV ) 010 RCL 0 1 + // R0 holds interest per period 013 LN RCL 1 CHS * // R1 holds number of periods 017 e^x 1 x><y 020 - RCL 0 / 023 RTN

Resources Used
Memory : 23 steps
Registers :
R0 : interest rate per period
R1 = number of periods
Labels :
LBL 9 : calculate payment for a given amount borrowed
LBL 6 : calculate amount borrowed for a given payment
LBL.9 : (internal) determine PVAF

Sample calculations :
$5000 borrowed at 10% with 36 monthly payments --> $161.34 / month
	10 ENTER 1200 / STO 0
	36 STO 1
	5000 GSB 9

$1500/month on a 30 year mortgage at 7.5% --> $215,526.44 borrowed
	7.5 ENTER 1200 / STO 0
	30 12 * STO 1
	1500 GSB 6
Note
You can find the necessary interest rate to match payment and loan amounts by using the SOLVE function along with six more memory steps, one label, and one register. For example, find out what interest rate would allow a 1500/month payment to handle a 3 year, 5000 loan.

023 LBL A // can use any label 024 STO 0 // save current guess 025 GSB .9 RCL 2 - // can use any register except R0 and R1 028 RTN

5000 ENTER 1500 / // find PVAF needed (33.33) STO 2 36 STO 1 // save PVAF and number of periods .005 SOLVE A // won't work without good initial guess 1200 * // convert to annual rate (5.06%)


Final Note
As noted in the HP-15C Advanced Functions Handbook, the math used for computing the annuity factors can suffer from roundoff errors when very low interest rates apply over a large number of periods. Using the technique outlined on page 181 of the handbook, an alternative subroutine .9 finds the correct answer.

009 LBL .9 // ( -- PVAF ) 010 STO I RCL 0 ENTER ENTER // save incoming x-register 014 1 + LN X><Y 018 LASTx 1 TEST 6 - // TEST 6 (X<>Y) 022 / * RCL 1 * 026 e^x 1/x 1 X><Y 030 - RCL 0 / 033 RCL I X><Y // restore X value to stack (above PVAF) 035 RTN


Running the example from the handbook, with 11.25% annual interest for payments each second (31,536,000 periods!) generates a present value annuity factor of 29,826,791.69 (instead of 33,221,310.84 returned by the original LBL .9 routine).

\\ 20110916 - cjmcc

Edited: 16 Sept 2011, 9:01 a.m.

Password:

[ Return to the Message Index ]

Go back to the main exhibit hall