**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.*

Chris McCormack - 21 Oct 2007

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!

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.

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

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

Memory : 23 steps

R0 : interest rate per period

R1 = number of periods

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 6Note

You can find the necessary interest rate to match payment and loan amounts by using the

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

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. *