Post Reply 
Discount Rate
04-10-2022, 12:19 PM (This post was last modified: 04-12-2022 11:16 PM by Thomas Klemm.)
Post: #7
RE: Discount Rate
After a closer inspection of the assembler code I noticed that in fact the following formula is used:

Newton Iteration

\[
\begin{align}
Z &= (1 + i)^{-n} \\
\\
i_\text{next} &= i \left[ 1 + \frac{P + \frac{Z - 1}{i}}{\frac{Z - 1}{i} + \frac{nZ}{1 + i}} \right]
\end{align}
\]

This saves two multiplications by \( i \) at the cost of one division.

Register

R0: n
R1: P = PV / PMT
R2: i
R3: u = 1 + i
R4: Z = u-n
R5: v = (Z - 1) / i


Program

It allows to reduce the program by 2 steps:
Code:
01: 24 00    : RCL 0
02: 24 01    : RCL 1
03: 41       : -
04: 02       : 2
05: 61       : *
06: 24 00    : RCL 0
07: 31       : ENTER
08: 15 02    : g x^2
09: 51       : +
10: 71       : /
11: 23 02    : STO 2
12: 01       : 1
13: 51       : +
14: 23 03    : STO 3
15: 24 00    : RCL 0
16: 32       : CHS
17: 14 03    : f y^x
18: 23 04    : STO 4
19: 01       : 1
20: 41       : -
21: 24 02    : RCL 2
22: 71       : /
23: 23 05    : STO 5
24: 24 01    : RCL 1
25: 51       : +
26: 24 00    : RCL 0
27: 24 04    : RCL 4
28: 61       : *
29: 24 03    : RCL 3
30: 71       : /
31: 24 05    : RCL 5
32: 51       : +
33: 71       : /
34: 01       : 1
35: 51       : +
36: 24 02    : RCL 2
37: 61       : *
38: 74       : R/S
39: 13 11    : GTO 11
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Discount Rate - SlideRule - 04-04-2022, 01:54 PM
RE: Discount Rate - Thomas Klemm - 04-08-2022, 07:44 PM
RE: Discount Rate - Albert Chan - 04-08-2022, 10:21 PM
RE: Discount Rate - Albert Chan - 04-09-2022, 12:50 PM
RE: Discount Rate - Eddie W. Shore - 04-10-2022, 11:29 PM
RE: Discount Rate - Albert Chan - 04-09-2022, 05:47 PM
RE: Discount Rate - Albert Chan - 04-10-2022, 04:03 AM
RE: Discount Rate - Thomas Klemm - 04-10-2022 12:19 PM
RE: Discount Rate - Albert Chan - 04-11-2022, 01:18 AM
RE: Discount Rate - Albert Chan - 04-11-2022, 03:11 PM
RE: Discount Rate - Albert Chan - 04-11-2022, 03:57 PM
RE: Discount Rate - Albert Chan - 05-11-2022, 06:22 PM
RE: Discount Rate - Thomas Klemm - 04-11-2022, 02:37 AM
RE: Discount Rate - Thomas Klemm - 04-11-2022, 08:48 PM
RE: Discount Rate - Thomas Klemm - 04-12-2022, 11:11 PM
RE: Discount Rate - Thomas Klemm - 04-12-2022, 11:13 PM
RE: Discount Rate - Thomas Klemm - 04-18-2022, 01:58 PM
RE: Discount Rate - rprosperi - 04-18-2022, 06:41 PM
RE: Discount Rate - Thomas Klemm - 04-18-2022, 07:03 PM



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