Post Reply 
Looking for TVM contributions
06-16-2024, 05:18 PM
Post: #52
RE: Looking for TVM contributions
I'm not sure how to put this without offending anyone intellectually, but I think this needs to be said to explain some very basic concepts and my thoughts on the subject of solving TVM rates.

Solving is never as accurate as the floating point precision MachEps (or ULP) suggests. No matter how we rewrite the algebraic formulations of the function and its derivative. Inaccuracy increases with increasing number of terms in the expressions of the function to solve and its algebraic or numerical derivative. Sure, some forms are more accurate than others in preventing cancelations and unnecessary rounding, but with TVM the input parameter space is large and unconstrained (except for i% and n).

When solving roots we cannot expect nor should we visualize function \( f(x) \) to cut a perfect skinny line through the x-axis at which there is a single point \( x \) that is the root \( f(x)=0 \) to find. No! Instead, it is a fat line with some thickness \( \varepsilon \). This thickness depends on the inaccuracy of evaluating \( y=f(x) \). This fat line cuts the x-axis with an interval \( [x-\varepsilon,x+\varepsilon] \) on which all \( x \) values return \( f(x)=0 \). If \( f(x) \) becomes shallow close to the root, then the fat line may project an even wider interval (any deviation in the height \( y \) moves \( x \) faster along the axis). Root finders like Newton and Secant jump to the next point \( x \) closer to the root based on the behavior (slope) of the function and its derivative at the previous point \( x \). But we only see a fat line at the previous point \( x \), not a skinny line. Getting accurate values of \( f(x) \) and \( f'(x) \) to stay on course to converge to the root is problematic with a fat line. What is the value of \( f(x) \) exactly? And what is the slope \( f'(x) \) at this point? Since we cannot get highly accurate answers, we may end up jumping away from the root and far enough to cause an overcorrection in the next step to jump to the other side of the root and so on, possibly ad infinitum.

Let me explain my thoughts on using a hybrid approach, that is, iterate with Secant after a few (one or two) Newton TVM rate solver steps. Theoretically Newton is a better method, but suffers more than Secant with "fat lines" as we know for TVM: tiny rates cause Newton to go crazy and lower floating point precision causes non-termination such as on 10 digit BCD calculators. (Disclaimer: unless more advanced termination conditions are used that strike a good balance between execution cost and accuracy.) Furthermore, claiming that Newton is always quadratically or even better to converge is nonsense in practice. Initially the first steps are converging faster for y=npmt(i%) toward the root. But this is not guaranteed to continue to the root and in practice there is a significant convergence slow down closer to the root or even overshooting and subsequent correcting.

Using Secant after Newton is conceptually similar to solving higher-order polynomial equations. To solve these, Euclidean division can be used to remove factor \( x-r \) after finding one root \( r \). This repeats until all roots were found. But this is not stable. Accuracy suffers greatly with higher polynomial orders and less precise arithmetic. Therefore, Weierstrass aka Durand–Kerner must be used as a final step to improve the roots iteratively (see e.g. NR and other sources).

Finally, the i% rate solution we find may slightly vary in practice and still be correct. There is no single value that is the only correct one. There is a range of correct i% values (the fat line, remember). It depends on the floating point precisions and on the given TVM parameters how wide this range of i% values is that are all roots of the TVM equation. Therefore, be very skeptical when comparing decimal places in the rate solution i%. Because TVM is a model, any i% that maintains TVM equilibrium is correct. Checking the TVM model just requires computing N, PV, PMT or FV given the solution we found for the rate i%. So after checking over two dozen TVM cases, I found that FV is the most sensitive to i%, i.e. \( {\rm error} = | FV - FV(i) | \) is nonzero for errors in i% when the errors in \( PV(i) \) and \( PMT(i) \) are sometimes zero. The "FV error" is a good metric to evaluate the accuracy of the root i%. Let's not use \( N(i) \) because the direct formula of N has an expression involving logarithms and terms that may introduce inaccuracies that have nothing to do with how accurate the root i% is.

Hope this helps.

- Rob

"I count on old friends to remain rational"
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Looking for TVM contributions - dm319 - 05-12-2024, 06:58 PM
RE: Looking for TVM contributions - dm319 - 05-12-2024, 08:48 PM
RE: Looking for TVM contributions - dm319 - 05-12-2024, 08:49 PM
RE: Looking for TVM contributions - dm319 - 05-12-2024, 08:00 PM
RE: Looking for TVM contributions - dm319 - 05-14-2024, 11:04 AM
RE: Looking for TVM contributions - dm319 - 05-14-2024, 05:58 PM
RE: Looking for TVM contributions - dm319 - 05-14-2024, 05:59 PM
RE: Looking for TVM contributions - dm319 - 05-14-2024, 08:34 PM
RE: Looking for TVM contributions - dm319 - 05-14-2024, 08:31 PM
RE: Looking for TVM contributions - dm319 - 05-15-2024, 01:00 PM
RE: Looking for TVM contributions - dm319 - 05-15-2024, 12:57 PM
RE: Looking for TVM contributions - dm319 - 05-24-2024, 10:05 PM
RE: Looking for TVM contributions - dm319 - 05-25-2024, 01:43 PM
RE: Looking for TVM contributions - dm319 - 05-25-2024, 08:40 PM
RE: Looking for TVM contributions - dm319 - 05-24-2024, 11:22 AM
RE: Looking for TVM contributions - dm319 - 05-24-2024, 02:58 PM
RE: Looking for TVM contributions - dm319 - 05-24-2024, 09:22 PM
RE: Looking for TVM contributions - dm319 - 06-02-2024, 02:46 PM
RE: Looking for TVM contributions - robve - 06-09-2024, 02:04 AM
RE: Looking for TVM contributions - dm319 - 06-09-2024, 12:15 PM
RE: Looking for TVM contributions - robve - 06-09-2024, 03:29 PM
RE: Looking for TVM contributions - dm319 - 06-09-2024, 06:05 PM
RE: Looking for TVM contributions - dm319 - 06-09-2024, 10:00 PM
RE: Looking for TVM contributions - robve - 06-12-2024, 08:48 PM
RE: Looking for TVM contributions - robve - 06-14-2024, 03:23 PM
RE: Looking for TVM contributions - robve - 06-14-2024, 10:11 PM
RE: Looking for TVM contributions - robve - 06-15-2024, 03:54 AM
RE: Looking for TVM contributions - dm319 - 06-12-2024, 11:56 PM
RE: Looking for TVM contributions - robve - 06-15-2024, 03:05 AM
RE: Looking for TVM contributions - robve - 06-15-2024, 05:48 PM
RE: Looking for TVM contributions - robve - 06-15-2024, 09:52 PM
RE: Looking for TVM contributions - robve - 06-15-2024, 01:38 PM
RE: Looking for TVM contributions - robve - 06-16-2024 05:18 PM
RE: Looking for TVM contributions - Werner - 06-17-2024, 05:11 PM
RE: Looking for TVM contributions - robve - 06-16-2024, 08:26 PM
RE: Looking for TVM contributions - dm319 - 06-16-2024, 11:55 PM
RE: Looking for TVM contributions - robve - 06-17-2024, 09:03 PM
RE: Looking for TVM contributions - robve - 06-18-2024, 03:27 AM
RE: Looking for TVM contributions - robve - 06-19-2024, 12:57 AM
RE: Looking for TVM contributions - robve - 06-19-2024, 02:01 AM
RE: Looking for TVM contributions - robve - 06-19-2024, 03:47 PM
RE: Looking for TVM contributions - robve - 06-20-2024, 04:03 AM
RE: Looking for TVM contributions - robve - 06-20-2024, 05:07 PM
RE: Looking for TVM contributions - robve - 06-20-2024, 04:30 PM
RE: Looking for TVM contributions - robve - 06-20-2024, 06:27 PM
RE: Looking for TVM contributions - robve - 06-20-2024, 02:33 AM
RE: Looking for TVM contributions - robve - 06-21-2024, 09:04 PM
RE: Looking for TVM contributions - robve - 06-22-2024, 08:00 PM
RE: Looking for TVM contributions - robve - 06-23-2024, 06:03 PM
RE: Looking for TVM contributions - dm319 - 07-05-2024, 09:39 PM
RE: Looking for TVM contributions - dm319 - 07-05-2024, 09:44 PM



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