Solving the TVM equation for the interest rate
|
04-16-2018, 06:34 PM
Post: #11
|
|||
|
|||
RE: Solving the TVM equation for the interest rate
(04-15-2018 09:38 PM)Dieter Wrote: Problem 2: the guess is very good (0,171% vs. 0,169% exact) and already after the second loop the absolute error is less than 2E–8. So once again one should expect the error to drop below the given threshold after 3 iterations. But in this case the Newton algorithm finally has problems to get the desired number of significant digits, so it takes 11 iterations. This nicely shows the numeric pitfalls mentioned above. But this is not related to the initial guess. The major reason for this behaviour is the relative (!) error threshold in the 11C/15C program. Due to digit cancellation especially for small interest rates this target sometimes is not met as the true calculated error is inexact due to roundoff errors. So i has up to 9 decimals, but the number of significant digits decreases as i gets close to zero. That's why I'd suggest switching to an absolute error check, i.e. simply remove line 78 RCL 2 and 79 / from the code. This way the iteration converges after merely 2 loops. Please also note my remarks in post #9 of the linked thread. Dieter |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)