Post Reply 
TVM solve for interest rate, revisited
06-24-2024, 12:46 PM (This post was last modified: 06-24-2024 03:31 PM by Albert Chan.)
Post: #52
RE: TVM solve for interest rate, revisited
(06-21-2024 03:11 PM)Albert Chan Wrote:  Last example, if we set P=0.01, big edge = 100%, center about 50%
Both guesses will cause S=EXPM1(LOGP1(I)*N) to overflow.
This does not mean algorithm is wrong ... we just need a better FNF, for big rate.

Fixed iter_i() code to handle big rate overflow issue.
If s overflowed, it use asymptote line: f = pv*i + pmt

lua> n, pv, pmt, fv = 365*24*60, 0.01, -0.01, 5260.382426
lua> tvm(n,0.5,pv,pmt,fv, true) -- guess about edges center
0.5         -0.005     0.01
1            0            0.01
1
lua> tvm(n,false,pv,pmt,fv, true) -- big edge, beyond OK too
1            0            0.01
1

Update: guess can now be -100%, or less!
Implementation is cheap, if i ≤ -1, then f = -fv*i + pmt

This made guess formulas safer to use, as long as overshoot is still finite.
Of course, edge rates are safest, with guaranteed no overshoot.

Updates in post #46
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: TVM solve for interest rate, revisited - Albert Chan - 06-24-2024 12:46 PM



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