Post Reply 
Finance problems (TVM) on hp 49G+ hp 50G Periods and compounds per year are different
06-11-2024, 11:05 PM
Post: #21
RE: Finance problems (TVM) on hp 49G+ hp 50G Periods and compounds per year are diffe
TVM to get i2 = (1+i)^n - 1

lua> n, i = 12, 0.005
lua> tvm(n, i, -1, 0, nil) - 1 -- Naive way, probably not accurate
0.06167781186449961
lua> tvm(n, i, 0, -i, nil) -- Werner's way, very accurate
0.06167781186449957
lua> expm1(log1p(i)*n) -- reference
0.06167781186449957

(06-08-2024 11:47 PM)Albert Chan Wrote:  Solve with split loan method
f(x) = x + (pv+fv) / ((1+i)^n-1), where i = pmt / (x-pv)
Code:
Loan:  n  pv    pmt  fv
#1:    n  pv-x  pmt  x-pv      --> i = pmt / (x-pv)
#2:    n  x     0    (pv+fv)-x --> x = -(pv+fv) / ((1+i)^n-1)

I just noticed loan #2 can use Werner's trick to solve x too!
To make this clear, lets scale PV column to -1, matching naive way.

{PV, PMT, FV} = {x, 0, (pv+fv)-x} --> scale by (-1/x) --> {-1, 0, 1 + -(pv+fv)/x}

--> i2 = -(pv+fv) / x
--> x = -(pv+fv) / i2

lua> n,i,pv,pmt,fv = -40, -0.5, 2000, 1000, -1900

Solve for x, both ways:

lua> -(pv+fv) / (tvm(n,i,-1,0,nil)-1) -- Naive way
-9.094947017737554e-11

lua> -(pv+fv) / tvm(n,i,0,-i,nil) -- Werner's way
-9.094947017737554e-11

We can of course scale the problem, shift x to PMT column

{PV, PMT, FV} = {0, -i, i2} --> scale by (x/-i) --> {0, x, (pv+fv)/i}

lua> tvm(n,i,0,nil,(pv+fv)/i)
-9.094947017737554e-11
Find all posts by this user
Quote this message in a reply
Post Reply 




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