HP15C: Useful indirect addressing for Solve - Custom TVM
|
06-21-2024, 03:22 PM
(This post was last modified: 06-21-2024 03:33 PM by Pekis.)
Post: #1
|
|||
|
|||
HP15C: Useful indirect addressing for Solve - Custom TVM
Hello,
Nothing new here but as I was making a custom TVM for the HP-15C(E), I was impressed by its capabilities combining indirect addressing with Solve: So, with these registers: R1: M (Amount of loan) R2: air% (Annual interest rate) R3: y (Number of years) R4: ppy (Number of pay periods per year) R5: P (Amount of periodic payment) i: Register number of the variable to solve for (1, 2, 3, 4, or 5) R0, R6: Temporary variables If we define ir = periodic interest rate = (1+air%/100)^(1/ppy)-1 n = y * ppy = total number of payements We have to solve M * ir / (1-(1 + ir)^-n) - P = 0 for M, air%, y or P This 28-step program is enough: Code:
Using the program: How much to pay per month ? 250,000 (M) STO 1 2.4 (air%) STO 2 20 (y) STO 3 12 (ppy) STO 4 5 (Solve for P) STO i 1100 (Guess) SOLVE A => P = 1,309.46 per month Same but how many years if P = Max 1,000 per montht ? 1,000 STO 5 3 (Solve for y) STO i 25 (Guess) SOLVE A => y = 28.7720 years Same but which annual interest rate if P = Max 1,200 per month ? 20 STO 3 (restore initial y) 1,200 STO 5 2 (Solve for air%) STO i 1 (Guess) SOLVE A => air% = 1.45% per year Same but which amount of loan if P = Max 1,100 per month ? 2.4 STO 2 (restore initial air%) 1,100 STO 5 1 (Solve for M) STO i 200,000 (Guess) SOLVE A => M = 210,009.44 Still amazed |
|||
06-27-2024, 09:27 AM
Post: #2
|
|||
|
|||
RE: HP15C: Useful indirect addressing for Solve - Custom TVM
Thanks to an idea of Karl Schneider published in this forum in 2003, this deserves to be included in the owner's handbook about Solve:
"Solve can solve for any register involved in the called subroutine" To solve for the x register: LBL A <Use the x value, along with other values or registers> ... <Result in x register> RTN (Guess) SOLVE A To solve for a storage register in particular: LBL A STO <n> (Store x value in R<n>) or STO (i) (if i is preloaded with value <n>) ... <Use the R<n> value, along with other values or registers> ... <Result in x register> RTN <n> STO i (If "STO (i)" is used in the subroutine) (Guess) SOLVE A The use of "STO (i)" allows to choose which register to solve for in a calculation involving one or more registers |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)