Post Reply 
Looking for TVM contributions
05-25-2024, 01:09 AM
Post: #28
RE: Looking for TVM contributions
(05-24-2024 10:05 PM)dm319 Wrote:  do_n(I%YR = 25%, PV = -100000, PMT = 2083.333334, FV = 0, p = 0)

lua> i,pv,pmt,fv = .25/12, -1e5, 2083.333334, 0
lua> -(pv + fv) / (fv*i - pmt) * i
-0.99999999968
lua> -log1p(_) / log1p(i) -- do_n()
1060.303385972225

We avoided cancellation error, (fv*i - pmt) = -pmt, but it had to calculate -log1p(-1 + ε)

lua> pv*i, pmt
-2083.333333333333      2083.333334
lua> pv*i + pmt
6.666668923571706e-07
lua> -(pv + fv) / _ * i
3124998942.076121
lua> log1p(_) / log1p(i) -- do_n(), time-symmetric version
1060.3033735821105

If we apply time symmetry, -log1p(-1+ε) issue goes away.
However, (pv*i + pmt) denominator had massive cancellation!

Let's scale money by 3e6, to avoid massive cancellation error
(we work with integers, to avoid lua dec↔bin conversion error)

lua> pv,pmt = pv * 3e6, pmt * 3e6
lua> pv*i + pmt
2
lua> -(pv + fv) / _ * i
3.125e+09
lua> log1p(_) / log1p(i) -- do_n()
1060.30339000051

Plus42: 3.125E9 LN1+X .25 Enter 12 ÷ LN1+X ÷

1,060.303390000510007127328529884891

Quote:I couldn't understand why the plus42 code didn't have p in the equation.
But sounds like you are inverting time to work this out?
...
and this one:

do_n(I%YR = 25%, PV = -100000, PMT = 2040.816327, FV = 0, p = 1)

No, not time-symmetry.
p=1 get transformed to p=0, thus not in tvm formula. (see tvm_begin())

For this problem, we have exactly the same issue.
Again, scale money by 3e6, to avoid cancellation errors.

lua> pmt = 2040.816327 * 3e6
lua> pv, fv = pv+pmt, fv-pmt -- do_n(), p=0
lua> pv, pmt, fv
-293749999998      6250000002      -6250000002
lua> pv*i + pmt -- = 23 / 16
1.4375
lua> -(pv + fv) / _ * i -- = 1e11 / 23
4347826086.956522
lua> log1p(_) / log1p(i) -- do_n()
1076.3195443677068

Plus42 : 1E11 Enter 23 ÷ LN1+X .25 Enter 12 ÷ LN1+X ÷

1,076.319544367706646435106131044347
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Looking for TVM contributions - dm319 - 05-12-2024, 06:58 PM
RE: Looking for TVM contributions - dm319 - 05-12-2024, 08:48 PM
RE: Looking for TVM contributions - dm319 - 05-12-2024, 08:49 PM
RE: Looking for TVM contributions - dm319 - 05-12-2024, 08:00 PM
RE: Looking for TVM contributions - dm319 - 05-14-2024, 11:04 AM
RE: Looking for TVM contributions - dm319 - 05-14-2024, 05:58 PM
RE: Looking for TVM contributions - dm319 - 05-14-2024, 05:59 PM
RE: Looking for TVM contributions - dm319 - 05-14-2024, 08:34 PM
RE: Looking for TVM contributions - dm319 - 05-14-2024, 08:31 PM
RE: Looking for TVM contributions - dm319 - 05-15-2024, 01:00 PM
RE: Looking for TVM contributions - dm319 - 05-15-2024, 12:57 PM
RE: Looking for TVM contributions - dm319 - 05-24-2024, 10:05 PM
RE: Looking for TVM contributions - Albert Chan - 05-25-2024 01:09 AM
RE: Looking for TVM contributions - dm319 - 05-25-2024, 01:43 PM
RE: Looking for TVM contributions - dm319 - 05-25-2024, 08:40 PM
RE: Looking for TVM contributions - dm319 - 05-24-2024, 11:22 AM
RE: Looking for TVM contributions - dm319 - 05-24-2024, 02:58 PM
RE: Looking for TVM contributions - dm319 - 05-24-2024, 09:22 PM
RE: Looking for TVM contributions - dm319 - 06-02-2024, 02:46 PM
RE: Looking for TVM contributions - robve - 06-09-2024, 02:04 AM
RE: Looking for TVM contributions - dm319 - 06-09-2024, 12:15 PM
RE: Looking for TVM contributions - robve - 06-09-2024, 03:29 PM
RE: Looking for TVM contributions - dm319 - 06-09-2024, 06:05 PM
RE: Looking for TVM contributions - dm319 - 06-09-2024, 10:00 PM
RE: Looking for TVM contributions - robve - 06-12-2024, 08:48 PM
RE: Looking for TVM contributions - robve - 06-14-2024, 03:23 PM
RE: Looking for TVM contributions - robve - 06-14-2024, 10:11 PM
RE: Looking for TVM contributions - robve - 06-15-2024, 03:54 AM
RE: Looking for TVM contributions - dm319 - 06-12-2024, 11:56 PM
RE: Looking for TVM contributions - robve - 06-15-2024, 03:05 AM
RE: Looking for TVM contributions - robve - 06-15-2024, 05:48 PM
RE: Looking for TVM contributions - robve - 06-15-2024, 09:52 PM
RE: Looking for TVM contributions - robve - 06-15-2024, 01:38 PM
RE: Looking for TVM contributions - robve - 06-16-2024, 05:18 PM
RE: Looking for TVM contributions - Werner - 06-17-2024, 05:11 PM
RE: Looking for TVM contributions - robve - 06-16-2024, 08:26 PM
RE: Looking for TVM contributions - dm319 - 06-16-2024, 11:55 PM
RE: Looking for TVM contributions - robve - 06-17-2024, 09:03 PM
RE: Looking for TVM contributions - robve - 06-18-2024, 03:27 AM
RE: Looking for TVM contributions - robve - 06-19-2024, 12:57 AM
RE: Looking for TVM contributions - robve - 06-19-2024, 02:01 AM
RE: Looking for TVM contributions - robve - 06-19-2024, 03:47 PM
RE: Looking for TVM contributions - robve - 06-20-2024, 04:03 AM
RE: Looking for TVM contributions - robve - 06-20-2024, 05:07 PM
RE: Looking for TVM contributions - robve - 06-20-2024, 04:30 PM
RE: Looking for TVM contributions - robve - 06-20-2024, 06:27 PM
RE: Looking for TVM contributions - robve - 06-20-2024, 02:33 AM
RE: Looking for TVM contributions - robve - 06-21-2024, 09:04 PM
RE: Looking for TVM contributions - robve - 06-22-2024, 08:00 PM
RE: Looking for TVM contributions - robve - 06-23-2024, 06:03 PM
RE: Looking for TVM contributions - dm319 - 07-05-2024, 09:39 PM
RE: Looking for TVM contributions - dm319 - 07-05-2024, 09:44 PM



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