TVM solve for interest rate, revisited
|
06-10-2024, 01:33 AM
Post: #36
|
|||
|
|||
RE: TVM solve for interest rate, revisited
(06-09-2024 06:42 PM)dm319 Wrote: Another bit of fun, this is for problem 4, which switches to the secant method as it hits zero. When rate is really tiny, there is almost no compounding effect. We can treat curve as linear, perhaps quadratic. iter_i() top branch does exactly that, f(ε) ≈ f(0) + f'(0)*ε + f''(0)/2!*ε² Problem 4: lua> n, pv, fv = 480, 1e5, 0 lua> pmt = -pv/n -- assumed 0% interest lua> pmt -208.33333333333334 C*pv + n*pmt = 0 C = -n*pmt / pv C-1 = (n*pmt+pv) / -pv = (n+1)/2*i + (n^2-1)/12*i² + ... Even if we use full precision, in binary or decimal, pmt has some error. (C-1 ≠ 0) Assume C-1 as linear is good enough. Solving Quadratic give same rate. lua> C1 = fma(n,pmt,pv) / -pv lua> C1 4.5474735088646414e-17 lua> i = C1 / ((n+1)/2) lua> i 1.8908413758272938e-19 |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 6 Guest(s)