41C/CV root finders
|
05-28-2015, 06:33 PM
Post: #35
|
|||
|
|||
RE: 41C/CV root finders
(05-28-2015 01:54 PM)Ángel Martin Wrote: With the new initial estimation there's a marginal improvement - two iteration less if compared against e-8, or just one less if using the e-9 criteria. This sounds like there is something wrong with f(i) and/or f'(i). Could you post these two formulas here? A Newton-style solver should converge roughly quadratically, and the version I use does so. Here are the iteration results for the sample case. "err_abs" is the applied correction (delta_i) in that iteration step, and "err_rel" is the quotient of this and the current approximation, i.e. delta_i : i. Code: Initial estimate: 0,08571428572 This nicely shows the quadratic convergence: the error is order of 10–1, 10–2, 10–5 and finally 10–9, Here the program quits since 1,72 E-9 is below the error limit of 5 E–8. (05-28-2015 01:54 PM)Ángel Martin Wrote: It occured to me the reason for the larger number of loops could be that I check for f(i)/f '(i) to meet that criteria, and not for f(i) alone. Sure, this is what I do as well. f(i)/f'(i) is the correction term, the mentioned "delta i". My 10-digit program quits if delta_i : i drops below 5E–8. Due to the quadratic convergence one can expect the result to be exact to 12–14 digits, plus/minus a slight unavoidable error in the last digit(s) due to roundoff. (05-28-2015 01:54 PM)Ángel Martin Wrote: This is more demanding when f '(i)<1, as the quotient would be larger than the numerator and thus a bit counterproductive... Are there really cases where f'(i) is less than 1? Usually f'(i) is of similar magnitude as the payments, i.e. around 100 or 1000. For the sample case I get values around 4000 or 5000. You seem to use a different definition of the TVM function and its derivative. Sounds interesting, so again I would like to ask for the formulas you use. BTW, thank you for the MOD files. I will use them with V41 and see what's in there. ;-) Dieter |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)