TVM solve for interest rate, revisited
|
06-12-2022, 05:07 PM
Post: #9
|
|||
|
|||
RE: TVM solve for interest rate, revisited
Examples taken from previous post, where we have 2 rate solutions.
XCAS> tmv := ((pv+fv)/((1+x)^n-1) + pv)*x + pmt XCAS> f0 := tmv(n=30, pv=6500., pmt=-1000., fv=50000); f1 := f0' :; XCAS> [a, b] := [limit(x-f0/f1,x=-1), limit(x-f0/f1,x=inf)] [-1/50, 2/13] // = 2 edges, [pmt/fv, -pmt/pv] XCAS> m := fsolve(f1, x=a); f0(x=m) (0.100019883274, -6.52249630654) // f extremum XCAS> [fsolve(f0, x=a), fsolve(f0, x=b)] [0.0896058562612, 0.111003286405] // f roots Extremum(f) = f(x=m) < 0, and f have 2 roots ⇒ f has a concaved-up V shape. Halley's method, derived from g = f / sqrt(|f'|), Newton correction for g ≡ Halley correction for f XCAS> g0 := f0 / sqrt(abs(f1)):; g1 := g0':; g2 := g1':; g have the same roots as f (by its definition) Interestingly, g'' also have same roots as f XCAS> fsolve(g2, x=a..b) [0.0896058562612, 0.111003286405] // g'' roots = f roots XCAS> g2(x=a), g2(x=m), g2(x=b) (796.773155573, -2.55834266547e+38, 371.946352558) g is concave-down, for intervals between 2 roots, concaved-up otherwise. ⇒ Newton's method on g have 1-sided convergence, for whatever rate guess. ⇒ Halley's method on f have 1-sided convergence, for whatever rate guess. --- Paradoxically, f and g'' roots matched guaranteed 1-sided convergence is not true. (at least, not when f has only 1 root) From the extreme edge (-1,∞), f'' and g'' must have same sign. We had proved f'' have same sign throughout; g'' signs must be +/-/+, or -/+/- But, what happens if f has only 1 root ? g'' must still have 2 roots ! Disprove of Halley's 1-sided convergence, by counter-example We flip above exmple fv sign; f now has only 1 root. (overshoot rate in bold) lua> iter = loan_rate2(30,6500,-1000,-50000) lua> for i=1,5 do print(i, iter()) end 1 0.1511929109248802 0.1311929109248802 2 0.16524185831684263 0.014048947391962436 3 0.1652186592665784 -2.319905026425022e-005 4 0.16521865926667817 9.978337255768468e-014 5 0.1652186592666782 2.8509535016486494e-017 This counter-example, g'' roots = [0.0789877153657, 0.165218659267] g'' second root matched f (only) root. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)