Request TVM formula guidance
|
12-17-2014, 01:21 PM
(This post was last modified: 12-17-2014 10:48 PM by Dieter.)
Post: #9
|
|||
|
|||
RE: Request TVM formula guidance
(12-17-2014 01:56 AM)iMatt04bit Wrote: I am using the following formulas, where x is the interest rate in the form displayed on the calculator. I have not checked this yet. But how fast does it converge (# iterations) and which initial guess do you use? (12-17-2014 01:56 AM)iMatt04bit Wrote: I feel like the Newton method loses resolution for extremely small numbers, like 0.005/100 for an interest rate or smaller. That's not the fault of Newton's method. Expressions like (1+i)n – 1 cause severe roundoff errors if implemented the way you did, i.e. with standard math functions like pow or exp. (12-17-2014 01:56 AM)iMatt04bit Wrote: So for an alternative I am experimenting with the Secant method (I have it working). Wiki is such a great resource. Methods like the secant method or Regula Falsi work fine if there are two initial approximations that bracket the true root with different signs of the function to solve, i.e. f(x1) * f(x2) < 0. How do you make sure this condition is met, and what are the two guesses you start with? (12-17-2014 01:56 AM)iMatt04bit Wrote: There are an impressive amount of root finder methods out there, so its hard to know what others may prove useful for an alternative. I think a primary concern is the difficulty in solving small numbers that approach zero. Again, that problem that can be addressed with a careful implementation. I will give an example. For the moment let's assume 15 digits working precision. Code:
Do the same calculation with 12 digits and 1+r will even numerically equal 1, leading to a plain zero. These problems can be avoided by using the already mentioned special functions ln(1+x) and ex–1. These are also available in Java as log1p and expm1. So you better do the above calculation this way: Code:
Of course this implementation is strongly recommended for any solving method. Dieter Edited to correct some typos |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)