Sunday, December 18, 2011

HP 15C Programming Tutorial - Part 16: Solving Multiple Input Equations (TVM Program)

Solving Multiple Input-Single Output Equations

In Part 16, we will use the HP 15C's solve feature to solve multiple input-single output (MISO) equations.

This tutorial will be using a technique introduced by Karl Schneider. Please click on this link to read about it.

It involves using a program to write the equation f(x1, x2, x3, ...) = 0. The equation begins with the instructions: LBL #, STO(i); where # is the label letter/number of your choice. The next step is to put the variable number in memory register I. Finally, execute the solve function. Let's see this in action.

Volume of a Cylinder

In this first program will turn the volume of a cylinder into a MISO solver. The equation is:

V = π r^2 h

The first step is to make one side of the equation zero.

0 = π r^2 h - V

We'll have to designate memory registers for each of the variables. Let's use:

R1 = r
R2 = h
R3 = V

The equation can be seen as:

0 = π R1^2 R2 - R3

Next enter the program:


Key Codes Keys
001 42 21 11 LBL A
002 44 25 STO(i)
003 43 26 π
004 45 1 RCL 1
005 43 11 x^2
006 20 ×
007 45 20 2 RCLx 2
008 45 3 RCL 3
009 30 -
010 43 32 RTN


Now we can use the program as MISO solver.

Example 1: Given V = 1,000 and h = 10. Find r.

The variable r corresponds to R1. This means we store 1 in memory register I. Give an initial interval (0, 1000).

Key Strokes:
1000 [STO] [ 3 ]
10 [STO] [ 2 ]
1 [STO] [TAN] ( I )
0 [ENTER] 1000 [ f ] [ ÷ ] (SOLVE) [ √ ] (A)

Answer: r ≈ 5.6419

Example 2: Given V = 2,498.65 and r = 39.43. Find h. Use an initial interval (0, 1000). We are looking for h, so store 2 in memory register I.

Key Strokes:
2498.65 [STO] [ 3 ]
39.43 [STO] [ 1 ]
2 [STO] [TAN] ( I )
0 [ENTER] 1000 [ f ] [ ÷ ] (SOLVE) [ √ ] (A)

Answer: h ≈ 0.5116

Time Value of Money

This program uses the solver capabilities to solve common financial programs.

The equation:

0 = PV + PMT × ((1 - (1 + I)^-N) / I) + FV × (1 + I)^-N

We will designate the following registers for the variables:
R1 = N (number of periods)
R2 = I (periodic interest rate, entered as a decimal)
R3 = PV (present value)
R4 = PMT (payment)
R5 = FV (future value)

End-of-period payments is assumed.

We can rewrite the equation as this:

0 = R3 + R4 × ((1 - (1 + R2)^-R1) / R2) + R5 × (1 + R2)^-R1

Program:


Key Codes Keys
001 42 21 11 LBL A
002 44 24 STO(i)
003 1 1
004 45 40 2 RCL+2
005 45 1 RCL 1
006 16 CHS
007 14 y^x
008 16 CHS
009 1 1
010 40 +
011 45 10 2 RCL÷ 2
012 45 20 4 RCLx 4
013 1 1
014 45 40 2 RCL+ 2
015 45 1 RCL 1
016 16 CHS
017 14 y^x
018 45 20 5 RCLx 5
019 40 +
020 45 40 3 RCL+ 3
021 43 32 RTN


Example 1: Given N = 360, I = 5%/12, PV = 200,000, and FV = 0, find PMT. PMT refers to memory register 4. (Store 4 in RI). Give an initial interval of (0, 1000).

Key Strokes:
360 [STO] [ 1 ]
.05 [ENTER] 12 [ ÷ ] [STO] [ 2 ]
200000 [STO] [ 3 ]
0 [STO] [ 5 ]
4 [STO] [TAN] ( I )
0 [ENTER] 1000 [ f ] [ ÷ ] (SOLVE) [ √ ] (A)

Answer: PMT = -1073.6432 ($1,073.64)

Example 2: Given N = 48, PV = 25,000, PMT = -600, and FV = 0, solve for I. The variable I refers to memory register 2. (Store 2 in RI). Give an initial interval of (0.1, 1).

Caution: When solving for interest, do not use 0 as an endpoint of an interval, for this will cause an "Error 0" condition.

Key Strokes:
48 [STO] [ 1 ]
25000 [STO] [ 3 ]
600 [CHS] [STO] [ 4 ]
0 [STO] [ 5 ]
2 [STO] [TAN] ( I )
0.1 [ENTER] 1 [ f ] [ ÷ ] (SOLVE) [ √ ] (A)
(to find the annual rate) 12 [ × ]

Answer: I = .0059 (Periodic Rate 0.59%), .0712 (Annual Rate 7.12%)

Example 3: Given N = 10, I = .03, PV = -1000, PMT = -250, solve for FV. This time we are solving for variable # 5 (FV). Use an initial interval (1000, 5000).

Key Strokes:
10 [STO] [ 1 ]
.03 [STO] [ 2 ]
1000 [CHS] [STO] [ 3 ]
250 [CHS] [STO] [ 4 ]
5 [STO] [TAN] ( I )
1000 [ENTER] 5000 [ f ] [ ÷ ] (SOLVE) [ √ ] (A)

Answer: FV = 4209.8862 ($4,209.89)

Thank you for joining me for another session.

Source: Schneider, Karl. "SOLVE and INTEG on HP's RPN-based models" HP Articles. Museum of HP Calculators. October 2, 2005. http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/articles.cgi?read=556

Thank you Karl!!!




This tutorial is property of Edward Shore. © 2011

Spotlight: Akron Brass FireCalc Pocket Computer

Spotlight: Akron Brass FireCalc Pocket Computer Welcome to a special Monday Edition of Eddie’s Math and Calculator blog. Thi...