TVM solve for interest rate, revisited
|
11-10-2024, 10:42 PM
(This post was last modified: 11-14-2024 10:44 PM by Albert Chan.)
Post: #61
|
|||
|
|||
RE: TVM solve for interest rate, revisited
(11-06-2024 12:20 AM)Albert Chan Wrote: f = c0 + sum((c1+k*x)/(r+1)^(x+1), x=0 .. n-1) From Ángel Martin's thread for IRR rate calculation, where c1 increase by step k each period. If we add the fv term, above IRR calculations can solve TVM problem! (just set step k = 0) Let's change variables name to match TVM: pv=c0, c1=pmt, step s=k, and add fv to the mix. Code: PV PMT FV SCALE K*PV + FV = 0 ; row 1 K = -FV/PV = -(fv*r² - s*n*r - (pmt*r+s)) / (pv*r^2 + (pmt*r + s)) If s = 0, formula reduced to plain TVM, we have: K = (pmt - fv*r) / (pmt + pv*r) > 0 This explained why edge rate are [pmt/fv, pmt/-pv]. They are simply the roots for top and bottom! Same idea for s≠0, only the edges may now have 2 roots, not 1 Just like we solve for plain TVM, we solve npmt=0, for rate Just like we solve for plain TVM, we fit npmt (tiny rate) with a quadratic. Code: function npmt_step(n,s,pv,pmt,fv) lua> f = npmt_step(5, 5, -25, 10, 0) -- quoted IRR example lua> S.newton(f, 0.7, nil, nil, true) 0.7 0 0.5670681661803514 2 0.5672303344166845 4 0.5672303344358538 6 lua> f = npmt_step(36, 0, 30000, -550, -15000) -- car lease example lua> S.newton(f, 0, nil, nil, true) 0 0 0.0058695853637202935 2 0.005805080703249694 4 0.0058050728194123016 6 0.005805072819420133 7 lua> _ * 1200 -- APR % 6.96608738330416 Update: npmt_step() with an extra term for pv,fv, emphasized symmetry. Cas> K := exp(log1p(r)*n); /* = (1+r)^n */ Cas> C := n*r / (1-1/K); /* compounding factor */ Cas> series(C, r) \(1+\frac{(1+n)}{2} \cdot r+\frac{(-1+n^{2})}{12} \cdot r^{2}+\frac{(1-n^{2})}{24} \cdot r^{3}+\frac{(-19+20\cdot n^{2}-n^{4})}{720} \cdot r^{4}+\frac{(9-10\cdot n^{2}+n^{4})}{480} \cdot r^{5}+r^{6} \mathrm{order\_size}\left(r\right)\) Code: function npmt_step(n,s,pv,pmt,fv) (small rate first term)*n = pv + fv + n*pmt = pv + (fv-n*s/r) + n*(pmt+s/r) |
|||
11-10-2024, 10:44 PM
(This post was last modified: 11-11-2024 11:40 AM by Albert Chan.)
Post: #62
|
|||
|
|||
RE: TVM solve for interest rate, revisited
Previous post TVM with steps option, for HP71B (updated npmt_step())
Code: 10 DESTROY ALL @ INPUT "N,S,P,M,F= ";N,S,P,M,F >run N,S,P,M,F= 5,5,-25,10,0 GUESS I= 0.7 .699 .701 .567068171084 .633034085542 .567230379538 .567230334434 .567230334434 >run N,S,P,M,F= 36,0,30000,-550,-15000 GUESS I= 0 -.001 .001 5.86958536385E-3 5.80447251183E-3 5.80507274543E-3 5.83732905464E-3 5.80507281939E-3 5.82120093702E-3 5.80507281943E-3 5.80507281943E-3 >res * 1200 ! APR % 6.96608738332 |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)