TVM solve for interest rate, revisited
|
05-13-2022, 09:31 PM
(This post was last modified: 06-16-2022 02:52 PM by Albert Chan.)
Post: #1
|
|||
|
|||
TVM solve for interest rate, revisited
From https://www.hpmuseum.org/cgi-sys/cgiwrap...ead=234439
Dieter Wrote:I just had a look at the TVM solver that comes with the 34s library software. In most cases there is no closed form solution for the interest rate, so the iterative solver is used. However, the two required initial guesses are simply -100% and (at least) +1000%. While it is true that the result usually will be somewhere in this interval, I think we can do better ... To "bracket" rate, it may be better to transform TVM equation, with tanh. abs(tanh(x)) ≤ 1 Solve TVM for rate x, using NPMT=0 form: f = NPMT/n = x/expm1(n*log1p(x))*(pv+fv) + pv*x + pmt Let C = x*n / (1-1/K), where K = (1+x)^n Let Ce = C - n*x/2 Let A = (pv+fv)/2 Let B = (pv−fv)/2 f = (Ce−n*x/2)*(pv+fv)/n + pv*x + pmt = (2A)*(Ce/n) + B*x + pmt Ce is even function of n = (C(n=n) + C(n=-n)) / 2 = (x*n/(1-1/K) + x*(-n)/(1-K)) / 2 = x*n/2 * (1+K)/(1-K) = x*n/2 * (√K + 1/√K) / (√K - 1/√K) = x*n/2 / tanh(ln(√K)) = x*n/2 / tanh(n/2*log1p(x)) Let t = tanh(n/2*log1p(x)), put Ce back to NPMT: f = A*x/t + B*x + pmt f = 0 → x = -pmt / (A/t + B) t = -1 .. 1 → x = pmt/fv .. -pmt/pv This assumed pmt ≠ 0 If pmt = 0, we can directly solve for rate, fv = K*pv If either fv or pv = 0, we only have 1 "edge", but that is OK, With x guaranteed 1 solution, we just start from the finite edge. Comment x ranges assumed its edges have opposite sign. → (pv, fv) have opposite sign → |A| > |B| → Denominator (A/t + B) never hit zero, since t = [-1,1] |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 8 Guest(s)