Post Reply 
Looking for TVM contributions
05-24-2024, 02:20 PM (This post was last modified: 05-24-2024 04:01 PM by SlideRule.)
Post: #21
RE: Looking for TVM contributions
Are you familiar with the following publication, Time, Value, Money: applications on the TI-83, EXPLORATIONS, by Texas Instruments?

BEST!
SlideRule
Find all posts by this user
Quote this message in a reply
05-24-2024, 02:58 PM
Post: #22
RE: Looking for TVM contributions
(05-24-2024 02:20 PM)SlideRule Wrote:  Are you familiar with the following publication, Time, Value, Money: applications on the TI-83, EXPLORATIONS, by Texas Instruments?

BEST!
SlideRule

No I'm not - don't suppose you have a link?
Find all posts by this user
Quote this message in a reply
05-24-2024, 03:04 PM
Post: #23
RE: Looking for TVM contributions
(05-15-2024 12:57 PM)dm319 Wrote:  I had a go last night adapting the plus42 code into R and using the Rmpfr package which has arbitrary precision ...
I think I now have an arbitrary precision calculator, which looks like it will show plus42 is getting the best accuracy.

Plus42 algorithm to check Plus42 may not show numbers are accurate.
Unless, of course, Rmpfr setup with much higher precisions to compensate.

For better accuracy, we may apply time-symmetry.

Plus42 core_commands9.cc
Code:
do_pv():
pv = -(pmt * (-expm1(-n * log1p(i)) / i) + fv * exp(-n * log1p(i)))

do_fv():
fv = -(pv + pmt * (-expm1(-n * log1p(i)) / i)) / exp(-n * log1p(i))

expm1(-n*log1p(i)) == (1+i)^-n - 1

The problem is with positive (n*i), and |n| is huge, expression approaches -1.
Numerically, there are only so many representable numbers between -0.9 to -1.0

lua> expm1(-30), expm1(30)
-0.9999999999999064      10686474581523.463

We may use time symmetry, turned n to -n: {n,i,pv,pmt,fv} --> {-n,i,fv,-pmt,pv}

fv = -(-pmt * (-expm1(n * log1p(i)) / i) + pv * exp(n * log1p(i)))
pv = -(fv - pmt * (-expm1(n * log1p(i)) / i)) / exp(n * log1p(i))

Plus42 core_commands9.cc
Code:
do_n():         
n = -log1p(-(pv + fv) / (fv - (pmt / i))) / log1p(i);

do_i_pct_yr(): 
f(i) = ((pv+fv)/expm1(log1p(i)*n) + pv) * i + pmt 
f(i) = 0, solved for i, by newton's method.

do_pmt():
pmt = -((pv + fv) / expm1(n * log1p(i)) + pv) * i

do_n() is better if |fv| is small (best if fv=0)
do_i_pct_yr() and do_pmt() is better if |pv| is small. (best if pv=0)

Apply time-symmetry to reduce cancellation errors, we get tvm(n,i,pv,pmt,fv), and tvm_begin(n,i,pv,pmt,fv)
Find all posts by this user
Quote this message in a reply
05-24-2024, 04:09 PM
Post: #24
RE: Looking for TVM contributions
(05-24-2024 02:58 PM)dm319 Wrote:  … have a link?

Time, Value, Money: applications on the TI-83

BEST!
SlideRule
ps: revised original post w/ url
Find all posts by this user
Quote this message in a reply
05-24-2024, 09:22 PM
Post: #25
RE: Looking for TVM contributions
(05-24-2024 04:09 PM)SlideRule Wrote:  BEST!
SlideRule

Thank you for the link, it looks to be the same app I am using on the TI-83+. Very useful book, which really covers so many aspects of finance calculations. Not so keen on the UI of that application though!
Find all posts by this user
Quote this message in a reply
05-24-2024, 10:05 PM
Post: #26
RE: Looking for TVM contributions
(05-24-2024 03:04 PM)Albert Chan Wrote:  Plus42 algorithm to check Plus42 may not show numbers are accurate.
Unless, of course, Rmpfr setup with much higher precisions to compensate.

Yes, throwing all the digits at it! And requiring the solver to reach the current precision, so I think it's fairly trustworthy for i. Though there's a question for you further down...

(05-24-2024 03:04 PM)Albert Chan Wrote:  Apply time-symmetry to reduce cancellation errors

Thank you Albert. As usual, it will take me several months before I start to understand this. However, this makes more sense now, as 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? Clever!

I'm trying to work out how accurate plus42 and my solver is for this problem:

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

and this one:

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

Just curious what you would calculate the accuracy of plus42 for this? I'm using a lot of digits in R, but this one is more discrepant that usual.
Find all posts by this user
Quote this message in a reply
05-24-2024, 11:50 PM
Post: #27
RE: Looking for TVM contributions
Business Interest Calculations is another significant source for TVM solutions on the HP-12C programmable calculator.

BEST!
SlideRule
Find all posts by this user
Quote this message in a reply
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
05-25-2024, 01:43 PM
Post: #29
RE: Looking for TVM contributions
(05-25-2024 01:09 AM)Albert Chan Wrote:  Let's scale money by 3e6, to avoid massive cancellation error
(we work with integers, to avoid lua dec↔bin conversion error)

This makes me despair!!

So sadly my compensating for my lack of mathematical knowledge with increasing precision, is not working out for me:

Code:

library(gmp)
library(Rmpfr)

precision <- 10000
# puzzle 9
pv <- mpfr(-100000,precision)
pmt <- mpfr(2083.333334,precision)
fv <- mpfr(0, precision)
IYR <- mpfr(25, precision)
p <- mpfr(0, precision)
i <- IYR/(12*100)

n1 <- -log1p(-(pv + fv) / (fv - (pmt / i))) / log1p(i)

n2 <- (log(((pmt/i)-(fv/(p*i+1))) / ((pmt/i) + (pv/(p*i+1))))) / log1p(i)

both of these give me:

Code:

1 'mpfr' number of precision  10000   bits
[1] 1060.3033956365730090384434693947369944332594217441029408412558188595824689​8
07197727416491540572845724771896507857571886504645593944306692264628794541458664​
58375423987299210683040690941151541881600943597439200946194050745278676446824641​
22308492442087690860970281130563345009278271751455872151634391408166704880649109​
36560953812524965830911825634617920857371393424282737545176452224441577787055213​
55397968967845547018870310318782714581286940880506845575232921065579102830995323​
78297169131223357904509529505711631573769479966320792629536002388547705494759891​
13499830867482801277919361893430842428333623881131502795073509272425789926878404​
49287655654185996665707154173786718652623681278787355269122221268154986107820763​
09499536264183784510808630675021737654900426339895797764725156317864311935557783​
77587786551526764679188439065813551968978279754283196284231829605795887833476927​
13028551525341971456289627199795731118521055191679714226135668418430778336206266​
74148589292402718442232866928179681460786578

Which appears to be wrong! And this is because of bin vs floating point?

Doing this:
Code:
# puzzle 9
pv <- mpfr(-100000*1e6,precision)
pmt <- mpfr(2083.333334*1e6,precision)
fv <- mpfr(0, precision)
IYR <- mpfr(25, precision)
p <- mpfr(0, precision)
i <- IYR/(12*100)

yields this:

Code:

1 'mpfr' number of precision  10000   bits
[1] 1060.3033900005100071273285298848906180823838340012902916328077882286456560​4
67587797154042231760570816965193268087350457673808173817824369425165783401351710​
99540197107176323303843214218637432712791734842128998267675898433960363456544005​
73985869290944851399171956781789376949160160651066552772346138267487200165388817​
83881177551233430205977003938937254780686896285576491185865513724300961468927461​
39410639111661567009551041205609056550853001726428727432423987513856357612098433​
90877392697798564014002293884991869862295830743793682185049776543414317793488524​
45240336632154381953119107156898236643414036288075081516228104634138418186065164​
81977188712585191822615355535945030316937124047521501901678978734319093597922410​
38882686383353744057515178101263091218716538699461811792539274587624380362168296​
05607609304730776144555603929591857849473225109637792821792762882153016277493959​
02488400166725992143464757387708506056515128432922146545789675785619996182390349​
22646107693748379072370565015755372213602692

Which is closer to the plus42/nstk tvm result, and which sounds like is the correct one.

But I thought you could compensate for binary calculations by using more precision no?
Find all posts by this user
Quote this message in a reply
05-25-2024, 03:04 PM
Post: #30
RE: Looking for TVM contributions
(05-25-2024 01:43 PM)dm319 Wrote:  pmt <- mpfr(2083.333334,precision)

pmt turned float (53 bits precision), then mpfr. It should be quoted.

p2> from gmpy2 import *
p2> get_context().precision = 113 # binary128
p2> i = mpfr(25) / 1200
p2> pv = mpfr(-1e5)
p2> pmt = mpfr('2083.333334')
p2> fv = mpfr(0)
p2> -log1p(-(pv + fv) / (fv - (pmt / i))) / log1p(i)
mpfr('1060.30339000051000712732851994886109',113)
p2> log1p(-(pv + fv) / (pv + (pmt / i))) / log1p(i)
mpfr('1060.30339000051000712732851861304841',113)

Scale by million, to work with integer.

p2> pv *= 1e6
p2> pmt = rint(pmt * 1e6) # pmt rounded to integer
p2> log1p(-(pv + fv) / (pv + (pmt / i))) / log1p(i)
mpfr('1060.30339000051000712732852988489078',113)
Find all posts by this user
Quote this message in a reply
05-25-2024, 08:40 PM
Post: #31
RE: Looking for TVM contributions
(05-25-2024 03:04 PM)Albert Chan Wrote:  pmt turned float (53 bits precision), then mpfr. It should be quoted.

Oh my that makes sense! I checked the representation of 2083.333334 and the 64bit representation comes to 2.08333333399999992252560332417E3.

The risks of using a library I'm completely unfamiliar with!
Find all posts by this user
Quote this message in a reply
06-02-2024, 02:46 PM
Post: #32
RE: Looking for TVM contributions
(05-24-2024 11:50 PM)SlideRule Wrote:  Business Interest Calculations is another significant source for TVM solutions on the HP-12C programmable calculator.

BEST!
SlideRule

Thank you for sharing this, I've been reading through it - it's a very good read. Doesn't assume any basics but can quickly escalate to quite complicated problems (including the difficulties in solving for i).
Find all posts by this user
Quote this message in a reply
06-09-2024, 02:04 AM
Post: #33
RE: Looking for TVM contributions
Data for my wife's Ti BA II Plus and a Sharp EL-735 in my collection.

Code:
| #  | Ref        | N            | I%YR      | PV       | PMT          | FV        | P/YR | End |
|----|------------|--------------|-----------|----------|--------------|-----------|------|-----|
| 1  | DM         | 38 x 12      | 5.25%     | 270'000  | ?            | 0         | 12   | yes |
TI BA II Plus Professional PMT=-1368.148355
Sharp EL-735 PMT=-1368.148355

| 1b | DM         | 38 x 12      | ?         | 270'000  | -14'584/12   | 0         | 12   | yes |
TI BA II Plus Professional I%YR=4.373218372
Sharp EL-735 I%YR=4.373218367

| 2  | SlideRule  | 360          | 15% → 12% | 100'000  | ?-?          | 0         | 12   | yes |
TI BA II Plus Professional -1264.444022 - -1028.612597 = -235.8314251 => PV=6803.092175
Sharp EL-735 -1264.444022 - -1028.612597 = -235.8314251 => PV=6803.092175

| 3  | Kahan 1983 | 60x60x24x365 | 10%       | 0        | -0.01        | ?         | =N   | yes |
TI BA II Plus Professional FV=331667.0067
Sharp EL-735 FV=331559.3833

| 4  | DM         | 480          | 0 → ?     | 100'000  | ?→ PMT       | 0         | 12   | yes |
TI BA II Plus Professional I%YR=-6.652807E-14
Sharp EL-735 I%YR=0

| 5  | Dieter     | 10           | ?         | 50       | -30          | 400       | 1    | yes |
TI BA II Plus Professional I%=14.43587133
Sharp EL-735 I%=ERR

| 6  | Dieter     | 10           | ?         | 50       | -30          | 80        | 1    | yes |
TI BA II Plus Professional I%=-36.89336987
Sharp EL-735 I%=ERR

| 7  | A Chan     | 10           | ?         | -100     | 10           | 1e-10     | 12   | yes |
TI BA II Plus Professional I%YR=2.181818E-10
Sharp EL-735 I%YR=0

| 8  | Miguel     | 32           | ?         | -999'999 | 0            | 1e6       | 1    | yes |
TI BA II Plus Professional I%YR=3.125E-06
Sharp EL-735 I%YR=3.124E-06

| 9  | DM         | ?            | 25        | 100000   | -2083.333334 | 0         | 12   | yes |
TI BA II Plus Professional N=1060.279147
Sharp EL-735 N=1060.30339

| 10 | DM         | ?            | 25        | 100000   | -2040.816327 | 0         | 12   | no  |
TI BA II Plus Professional N=1076.286526
Sharp EL-735 N=1078.475379

| 11 | robve      | 60x24x365    | 1/6% → ?  | 0        | -0.01        | ?→ FV     | =N   | yes |
TI BA II Plus Professional FV=5260.382426 I%=3.17E-07 I%N=0.166666667
Sharp EL-735 FV=5258.756613 I%=1.99E-07 I%N=0.104784254

| 12 | robve      | 40           | ? → I%YR  | 900      | -400         | -1000 → ? | 1    | no  |
TI BA II Plus Professional I%=80 FV=-999.54
Sharp EL-735 I%=80 FV=-975.1051597

Results for the secant solver on Sharp and in C are forthcoming, after I verified it with more experiments. I may also elect to improve it a bit more.

- Rob

"I count on old friends to remain rational"
Visit this user's website Find all posts by this user
Quote this message in a reply
06-09-2024, 12:15 PM
Post: #34
RE: Looking for TVM contributions
(06-09-2024 02:04 AM)robve Wrote:  - Rob

Thank you Rob! This is great, and two interesting non-HP calculators too.

Very interesting that the TI returns for problems 5 and 6, much like the solver in the TI-83+, also choosing to return the same two roots (first one 14.4, second one the negative root). Which suggests to me they use a similar solver_for_i algorithm, but the precision is quite different between them. Overall the TI does very well, putting it squarely better than the HP-12c. Overall I put it at a similar level to the HP-10bII+ (due to adding new problems I don't have full data on the HP-10bII+) and just below the HP-12c platinum, but with quite different pros and cons.

The Sharp does especially badly on problem 3, which suggests it hasn't optimised the (1+i)^N - an issue on the HP-80 and HP-70. It conveniently finds 0 for problem 4, but like other ones that do this (like the BWK business and HP-92) it also finds 0 for problem 7 unfortunately. Problem 9 and 10 showed a good result with 9, but not the 'begin' counterpart 10. I had this issue with a particular formula on the DM42. It doesn't fair so well on your problem 11 - putting it above the HP-80 and 70 only. Overall I have put it above the HP-22/27, below the HP-37/38, and just below the Victor (though more data needed on the Victor).

I will update the results with these two.
Find all posts by this user
Quote this message in a reply
06-09-2024, 03:29 PM
Post: #35
RE: Looking for TVM contributions
(06-09-2024 12:15 PM)dm319 Wrote:  I will update the results with these two.

FYI to compare age. The Sharp is vintage from 1989 or about, a successor to the popular EL-733. They are similar, except that the EL-735 has more memory and a "database". The EL-735 is very easy to use with a well-thought through keypad layout like the 733, much easier than the new TI BA series. In my view, the Sharp is also one of the nicest looking machines in metal with distinguishable color keys and labels. But that's secondary.

- Rob

"I count on old friends to remain rational"
Visit this user's website Find all posts by this user
Quote this message in a reply
06-09-2024, 06:05 PM
Post: #36
RE: Looking for TVM contributions
Ah thank you Rob, I found it hard to find the date of the Sharp.

I can see they both have the n/i/pv/pmt/fv keys in that order (I guess established from the HP-37E onwards).

In terms of UI - do they work in the same way as the HPs, in that a second consecutive press of those buttons triggers a 'solve'.

The solver built into the HP-83+ is a right pain to use. It is set out like a table, then you use alpha-solve to solve for a specific value. You can calculate in-place (i.e. you can put 24x60x365 as input), but there isn't an intuitive way to do chain calculations on it. I.e. problem 2 is not fun to calculate as it needs constant to and fro-ing out of the application to the 'calculator' and back again.

Always had a fondness for Sharps - probably because that was my first one in a school that was 99% Casio.
Find all posts by this user
Quote this message in a reply
06-09-2024, 10:00 PM (This post was last modified: 06-09-2024 10:05 PM by dm319.)
Post: #37
RE: Looking for TVM contributions
These are the latest results:

Code:
| calculator                   | manufacturer | year    | ref      | 1     | 1b    | 2     | 3     | 4     | 5     | 6     | 7     | 8     | 9     | 10    | 11    | 12    |
| ---------------------------- | ------------ | ------- | -------- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- |
| NSTK TVM V8                  | enthusiast   | 2024    | 1        | -29   | -32   | -28   | -27   | -∞    | -32   | -32   | -32   | -37   | -30   | -30   | -27   | -∞    |
| C47 eadc4507f                | enthusiast   | 2024    | 4        | -29   | -32   | -28   | -24   | -18   | -32   | -32   | -24   | -36   | -27   | -27   | -27   | ERR   |
| NSTK TVM V6                  | enthusiast   | 2023    | 1        | -29   | -32   | -28   | -19   | -∞    | -32   | -32   | -32   | -37   | -26   | -27   | NA    | NA    |
| Plus42 1.1.9                 | enthusiast   | 2022    | 2        | -29   | -32   | -28   | -27   | -∞    | -31   | -31   | -30   | -35   | -26   | -27   | -30   | -20   |
| NSTK TVM V5                  | enthusiast   | 2023    |          | -29   | -30   | -28   | -19   | -9    | -30   | -31   | -9    | -30   | -30   | -21   | NA    | NA    |
| TI-83 Plus                   | TI           | 1999    |          | -10   | -12   | -8    | -7    | -∞    | -11   | -11   | -19   | -18   | -2    | -2    | -10   | 3     |
| RPN83P v0.9.0                | enthusiast   | 2023    | 4        | -9    | -12   | -9    | -7    | -∞    | ERR   | ERR   | -11   | -12   | -2    | -2    | -10   | 2     |
| ---------------------------- | ------------ | ------- | -------- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- |
| HP-17BII+ mk1                | HP           | 2003    | 9        | -8    | -10   | -6    | ERR   | -10   | ERR   | ERR   | -11   | -11   | NA    | NA    | NA    | NA    |
| HP-17BII                     | HP           | 1990    | 6        | -8    | -10   | -6    | -6    | -10   | ERR   | ERR   | -11   | -11   | NA    | NA    | NA    | NA    |
| HP-19II                      | HP           | 1990    | 9        | -8    | -10   | -6    | ERR   | -10   | ERR   | ERR   | -11   | -11   | NA    | NA    | NA    | NA    |
| HP-20b                       | HP           | 2008    | 8        | -8    | -10   | -6    | -6    | -10   | ERR   | ERR   | -11   | -11   | -3    | -2    | -10   | 1     |
| HP-30b                       | HP           | 2010    | 8, 9     | -8    | -10   | -6    | -6    | -10   | ERR   | ERR   | -11   | -11   | -3    | -2    | -10   | 1     |
| HP-50G                       | HP           | 2006    | 9        | -8    | -10   | -6    | -6    | -10   | ERR   | ERR   | -11   | -11   | NA    | NA    | NA    | NA    |
| ---------------------------- | ------------ | ------- | -------- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- |
| HP-12cp                      | HP           | 2003    |          | -8    | -10   | -6    | -6    | -10   | ERR   | ERR   | -21   | -11   | 0     | 1     | -10   | 1     |
| TI BA II Plus Professional   | TI           | 2004    | 16       | -6    | -9    | -4    | -4    | -12   | -8    | -8    | -16   | -9    | -1    | -1    | -9    | 0     |
| HP-10bII+                    | HP           | 2011    | 9        | -8    | -9    | -6    | -6    | -10   | ERR   | ERR   | -11   | -11   | NA    | NA    | NA    | NA    |
| BWK Business                 | BWK          | ?2007   | 9        | -7    | -9    | -6    | ERR   | -4    | -9    | -5    | -9    | -9    | NA    | NA    | NA    | NA    |
| HP-12c comma                 | HP           | ?2022   | 11       | -6    | -9    | -6    | 0     | ERR   | -8    | -8    | ERR   | -11   | 0     | 0     | NA    | NA    |
| Casio FC-200                 | Casio        | 1992    | 12       | -6    | -8    | NA    | -4    | -11   | ERR   | ERR   | -19   | -9    | NA    | NA    | NA    | NA    |
| HP-92                        | HP           | 1977    | 13, 14   | -6    | -8    | -4    | -4    | -∞    | ERR   | ERR   | -9    | -9    | 1     | 2     | -2    | 3     |
| HP-12c                       | HP           | 1981    | 8        | -6    | -8    | -4    | -4    | -8    | ERR   | ERR   | -9    | -11   | 3     | 2     | -4    | 3     |
| HP-37E                       | HP           | 1978    | 14       | -6    | -8    | -4    | -4    | -8    | ERR   | ERR   | -9    | -9    | 3     | 2     | -5    | 3     |
| HP-38E                       | HP           | 1978    | 14       | -6    | -8    | -4    | -4    | -8    | ERR   | ERR   | -9    | -9    | 3     | 2     | -5    | 3     |
| Victor V12                   | Victor       | 2007    | 9        | -6    | -9    | -4    | -4    | ERR   | ERR   | ERR   | ERR   | -13   | NA    | NA    | NA    | NA    |
| Sharp EL-735                 | Sharp        | 1989    | 16       | -6    | -7    | -4    | 3     | -∞    | ERR   | ERR   | -9    | -8    | -5    | 1     | 0     | 2     |
| HP-27                        | HP           | 1976    | 14       | -6    | -9    | -4    | -3    | -8    | ERR   | ERR   | ERR   | ERR   | 3     | ERR   | -4    | ERR   |
| HP-22                        | HP           | 1975    | 14       | -6    | -8    | -4    | -3    | -8    | ERR   | ERR   | ERR   | ERR   | 3     | ERR   | -4    | ERR   |
| HP-70                        | HP           | 1974    | 14       | -5    | -6    | -4    | 5     | -8    | ERR   | ERR   | ERR   | ERR   | 3     | ERR   | 2     | ERR   |
| HP-80                        | HP           | 1973    | 14, 15   | -6    | -4    | -5    | 5     | ERR   | ERR   | ERR   | ERR   | ERR   | 3     | ERR   | 2     | ERR   |

I was pondering the different strengths and weaknesses of the calculators - when you look through the results you start to get a feel for which calculators are similar and different to each other. It reminded me of some analyses I've carried out on high dimensional data. To be honest what follows is overkill, but it is interesting as long as the data isn't over-interpreted. Method: The above table, I switched all -Inf to -50, and all ERR to 10. NAs were then filled by random forest imputations, a small amount of noise was added, and each calculator was dimension-reduced using tSNE (T-test stochastic neighbour embedding). My understanding of this algorithm is that it looks at the probabilities of the calculator in relation to the density of other calculators, and tries to match this from the high dimensional environment to a 2d environment. It doesn't work that well for low numbers, and actually, I probably should have just used PCA. But it is done now and I have a plot. Ignore the x and y axis, and ignore overall distance or position. The only useful information is that close together calculators performed similarly.

[Image: 863toqp.png]

Enjoy!


Attached File(s) Thumbnail(s)
   
Find all posts by this user
Quote this message in a reply
06-12-2024, 08:48 PM
Post: #38
RE: Looking for TVM contributions
Results for the SHARP PC-1421 on an emulator (PockEmul). I trust the emulator is identical to the real metal, because it uses the original ROM with an emulated CPU.

Oof, this is interesting. It's not as good as the SHARP EL-735 results (1 1b 2 3 8 12) and even has some buggy output (4 5 6 11). Note that result 9 is the same as my SHARP program result. These test cases aren't vanilla TVM, but still disappointing and shows that rate solvers aren't created the same.

Code:
| #  | Ref        | N            | I%YR      | PV       | PMT          | FV        | P/YR | End |
|----|------------|--------------|-----------|----------|--------------|-----------|------|-----|
| 1  | DM         | 38 x 12      | 5.25%     | 270'000  | ?            | 0         | 12   | yes |
Sharp PC-1421 PMT=-1368.148355

| 1b | DM         | 38 x 12      | ?         | 270'000  | -14'584/12   | 0         | 12   | yes |
Sharp PC-1421 I%YR=4.373218366

| 2  | SlideRule  | 360          | 15% → 12% | 100'000  | ?-?          | 0         | 12   | yes |
Sharp PC-1421 -1264.444022 - -1028,612597 = -235.8314251 => PV=6803.092175 

| 3  | Kahan 1983 | 60x60x24x365 | 10%       | 0        | -0.01        | ?         | =N   | yes |
Sharp PC-1421 FV=331559.3833

| 4  | DM         | 480          | 0 → ?     | 100'000  | ?→ PMT       | 0         | 12   | yes |
Sharp PC-1421 I%YR=ERR

| 5  | Dieter     | 10           | ?         | 50       | -30          | 400       | 1    | yes |
Sharp PC-1421 I%=14.43587133

| 6  | Dieter     | 10           | ?         | 50       | -30          | 80        | 1    | yes |
Sharp PC-1421 I%=58.46195527

| 7  | A Chan     | 10           | ?         | -100     | 10           | 1e-10     | 12   | yes |
Sharp PC-1421 I%YR=0

| 8  | Miguel     | 32           | ?         | -999'999 | 0            | 1e6       | 1    | yes |
Sharp PC-1421 I%YR=3.124E-06

| 9  | DM         | ?            | 25        | 100000   | -2083.333334 | 0         | 12   | yes |
Sharp PC-1421 N=1040.639029

| 10 | DM         | ?            | 25        | 100000   | -2040.816327 | 0         | 12   | no  |
Sharp PC-1421 N=1051.968948

| 11 | robve      | 60x24x365    | 1/6% → ?  | 0        | -0.01        | ?→ FV     | =N   | yes |
Sharp PC-1421 FV=5258.756614 => I%=1.073741824E+09 !!!

| 12 | robve      | 40           | ? → I%YR  | 900      | -400         | -1000 → ? | 1    | no  |
Sharp PC-1421 I%=80 => FV=-975.1051597

- Rob

"I count on old friends to remain rational"
Visit this user's website Find all posts by this user
Quote this message in a reply
06-12-2024, 11:56 PM
Post: #39
RE: Looking for TVM contributions
Very interesting! Weird how they can be similar and so different, and what is going on with 11?!

The TVM program does very well on 3, much better than the calculators. 6 is a surprise result from PC-1421, 9 and 10 oddly best result with the 735. 11 is disaster for PC-1421, great result from the TVM program.

I've updated all results here:
https://forum.swissmicros.com/viewtopic....400#p32400

There are now a couple of graphs at the end just for fun.
Find all posts by this user
Quote this message in a reply
06-13-2024, 09:28 PM (This post was last modified: 06-25-2024 10:32 PM by Albert Chan.)
Post: #40
RE: Looking for TVM contributions
(06-12-2024 08:48 PM)robve Wrote:  | 11 | robve | 60x24x365 | 1/6% → ? | 0 | -0.01 | ?→ FV | =N | yes |
Sharp PC-1421 FV=5258.756614 => I%=1.073741824E+09 !!!
(06-12-2024 11:56 PM)dm319 Wrote:  Very interesting! Weird how they can be similar and so different, and what is going on with 11?!

Initial guess (hard coded?) may be too high for the problem.

Edge guess is not the best, but will converge without issue.
Plus42 does not allow user-input rate guess on purpose!

lua> n = 365*24*60 -- = 525600
lua> i = 1/(600*n) -- = 3.1709791983764586e-09
lua> fv = tvm(n,i,0,-1,nil)
lua> fv -- unit = cents
526038.2426000326
lua> tvm(n,nil,0,-1,fv) * n -- APR
0.0016666666666665247

Or, we can use a quickie formula
(04-09-2022 05:47 PM)Albert Chan Wrote:  \(\displaystyle I ≈ \frac{1}{P} - \frac{P}{N^2}\)

This is even better, and work well with big N.

P = -PV/PMT, so we apply time reversal, to FV/PMT. (negated N make no difference here)
1/P is edge rate, time reversal simply switched to other edge.

lua> p = -fv
lua> n/p - p/n -- APR estimate
0.001666895167500626

What if we supply a guess, say 0.1% ?

lua> tvm(n,1e-3,0,-1,fv, true)
0.001                                      -1
-5.137033888903107e+219     -nan
-nan                                       -nan
false

Why does it fail? Because we use Newton's method from the wrong edge!
The other edge = pmt/-pv = ∞, but 1e-3 is just as bad. (technically, ∞ is not an edge)

(06-11-2024 03:32 PM)Albert Chan Wrote:  For extreme rate, npmt(i) is basically linear, slope = (pv if n>0 else -fv)

With pv=0, npmt(i) look like L shape. Guess must be from the left of L
tvm() rate guess = pmt/fv ≈ -2e-6

For plots, I dropped fractional cents --> fv = 526038

This is what npmt look like from the left, and the right
npmt = ((pv+fv)/((1+x)^n-1) + pv)*x + pmt

plot 526038*x/((1+x)^525600-1)-1, x=-2e-6 .. 2e-6

plot 526038*x/((1+x)^525600-1)-1, x = 0 .. 1e-3



NPV is not the same as npmt, but same kind of issue apply.
NPV = (fv-pmt/x) * ((1+x)^-n-1) + (pv+fv)

plot (526038+1/x) * ((1+x)^-525600-1) + 526038, x = -2e-6 .. 2e-6

plot (526038+1/x) * ((1+x)^-525600-1) + 526038, x = 0 .. 1e-3
Find all posts by this user
Quote this message in a reply
Post Reply 




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