(32S) Accurate TVM with direct solutions
|
12-31-2015, 12:23 PM
(This post was last modified: 12-31-2015 01:59 PM by Dieter.)
Post: #7
|
|||
|
|||
RE: (32S) Accurate TVM with direct solutions
(12-30-2015 03:05 PM)Jeff_Kearns Wrote: While I applaud Dave for including his 'direct solutions' program, I have to disagree with a number of statements you each made. First of all, the accuracy of the 38-line, single-label SOLVER program is on par with that of any financial calculator. It includes both functions (e^(x–1) and ln(1+x)) to which you refer. Jeff, I see there is code for a ln(1+x) function (line T008 ff.), but I cannot find something similar for an e^x–1 function (NB: not e^(x-1), as you posted). Line T026 ff. simply takes the e^x result and subtracts 1 from it. ;-) That's why the solver program will produce errors for very small interest rates. For instance consider this example: N = 10 I = 1E–5 % B = 0 P = 1 E = 0 F = ? Since the interest rate is nearly zero, solving for F correctly returns F=–10,0000045 (i.e. ten times the 1,- payment plus with virtually nothing on top because of a near-zero interest rate). Fine. Now replace "I" with 1E–15% and see what you get... The solver will return F=0, which is obviously wrong. This happens because in step T026 the e^x command returns 1 and the following subtraction of 1 yields exactly zero. This is exactly what a dedicated e^x–1 command avoids. "But that's not a real world problem, nobody deals with interest rates that low". Well, the solver program is not able to handle zero interest rates (this causes a division by zero), so using a near-zero interest rate like 1E–20 or 1E–50 is required to handle this case. And here is where the current solver code fails. (12-30-2015 03:05 PM)Jeff_Kearns Wrote: I think you should type in the 38-line program and test it. You will see that it meets all your TVM needs, especially speed and accuracy ;-). Well... not quite. ;-) Addendum: Here is a version that includes both ln(1+x) – using a different method that IHMO performs even better than the original one – as well as an e^x–1 implementation and some slight general improvements. Code: T001 LBL T This code implements this method for ln(1+x) and that one for e^x–1. Dieter |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
(32S) Accurate TVM with direct solutions - Dave Britten - 05-17-2015, 12:55 AM
HP 35s - TVM from Gene Wright - PedroLeiva - 12-03-2015, 12:39 PM
RE: (32S) Accurate TVM with direct solutions - Jeff_Kearns - 12-26-2015, 11:24 PM
RE: (32S) Accurate TVM with direct solutions - Dieter - 12-30-2015, 08:22 AM
RE: (32S) Accurate TVM with direct solutions - Dave Britten - 12-30-2015, 12:13 PM
RE: (32S) Accurate TVM with direct solutions - Jeff_Kearns - 12-30-2015, 03:05 PM
RE: (32S) Accurate TVM with direct solutions - Dieter - 12-31-2015 12:23 PM
RE: (32S) Accurate TVM with direct solutions - Dave Britten - 12-31-2015, 01:37 PM
RE: (32S) Accurate TVM with direct solutions - Dieter - 12-31-2015, 01:49 PM
RE: (32S) Accurate TVM with direct solutions - Dave Britten - 12-31-2015, 02:08 PM
RE: (32S) Accurate TVM with direct solutions - Dieter - 01-01-2016, 02:11 PM
RE: (32S) Accurate TVM with direct solutions - Jeff_Kearns - 12-31-2015, 02:04 PM
|
User(s) browsing this thread: 3 Guest(s)