Post Reply 
TVM solve for interest rate, revisited
06-09-2024, 05:17 PM
Post: #33
RE: TVM solve for interest rate, revisited
(06-09-2024 04:46 PM)dm319 Wrote:  But just for fun, here is it with the problem above, initial guess of 10%, solving with 1000 bits of precision ...
* probably before your changes above, though I don't think you've changed the algorithm of the newton method?

It is the same Newton's method, f(i) = npmt(n,i,pv,pmt,fv)
But now {i, f(i)} is on the same row, for easy reading.

lua> tvm_begin(40, 0.1, 900, 1000, -1000, true)
Code:
0.1                     1189.774058558563
-0.5241790424643634     -48.35808492873343
-0.4999999999999902     -2.580691216280684e-11
-0.4999999999999773     -1.1368683772161603e-13
-0.49999999999997724    0
-0.49999999999997724

Last rate is really i - (f/f')/2, to reduce error radius.
Since f=0, there is no correction, last = previous
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: TVM solve for interest rate, revisited - Albert Chan - 06-09-2024 05:17 PM



User(s) browsing this thread: 4 Guest(s)