TVM solve for interest rate, revisited
|
06-13-2024, 01:05 PM
(This post was last modified: 06-15-2024 12:02 AM by Albert Chan.)
Post: #39
|
|||
|
|||
RE: TVM solve for interest rate, revisited
I recently discovered split loan method. Is this new?
![]() If loan split correctly, we can get a good guess rate, and formula to iterate for true rate. (06-08-2024 11:47 PM)Albert Chan Wrote: Solve with split loan method Here is one with huge true rate (see post #22, #27, #28, #29) lua> n, pv, pmt, fv = 10, -100, 10, 1e10 lua> tvm(n,nil,pv,pmt,fv, true) Code: 1e-09 999999995.5 tvm() picked time-reversed setup (x=0), edge = pmt/fv = 1e-9 The other edge (also x=0) is just as bad, edge = pmt/-pv = 0.1 Convergence is slow, because huge rate caused f(i) to be curvy. (07-16-2022 02:58 PM)Albert Chan Wrote: newx = function(x) return expm1(log1p(-(pv+fv)/(pmt/x+pv))/n) end Above is from post#29, I just realize this can be easily explained as a split loan! If we replace log1p(z) = ln(1+z), ln argument is: -(pv+fv) / (pmt/x+pv) + 1 = -(fv-pmt/x) / (pv+pmt/x) We might as well simplify this, with y = pmt/x Code: Loan: n pv pmt fv We don't have to use the setup to solve rate. Guess i when y=0 is already good. lua> y = 0 lua> i = EFF(-(pv+fv)/(y+pv), 1/n) -- guess lua> tvm(n,i,pv,pmt,fv, true) 5.30957344513139 9.999999722758162 5.321456835153608 0.08065988603186725 5.321554252697288 5.347635692487529e-06 5.321554259156789 -1.3642420526593924e-12 5.321554259156788 Here is another way to split loan. (any more ways?) Code: Loan: n pv pmt fv Sign checks: #1: sgn(pv+z) = sgn(-fv) #2: sgn(z) = sgn(n*pmt), because NPMT is time-symmetrical, f=NPMT/n is not lua> for loop=1,7 do i=APR(-fv/(pv+z)-1,n); z=pmt*-EFF(i,-n)/i; print(i,z) end 5.309573444801933 1.8833904463248339 5.321581577921809 1.8791405816968803 5.321554197006327 1.879150250410811 5.321554259298183 1.8791502284142771 5.321554259156466 1.8791502284643202 5.321554259156789 1.879150228464206 5.3215542591567875 1.8791502284642068 I don't know how to name this ... any idea? EFF(i,n) = (1+i)^n - 1 APR(i,n) = (1+i)^(1/n) - 1 But google search effective rate formula, it was normally defined with mul/div. To me this is less useful, so I added a third argument, in case true EFF, APR needed. EFF(i,n,true) = EFF(i/n,n) APR(i,n,true) = APR(i,n)*n lua> EFF(0.12, 12, true) 0.12682503013196972 lua> APR(_, 12, true) 0.12 |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)