HP Forums
Looking for TVM contributions - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: Not HP Calculators (/forum-7.html)
+--- Forum: Not quite HP Calculators - but related (/forum-8.html)
+--- Thread: Looking for TVM contributions (/thread-21729.html)

Pages: 1 2 3 4 5


Looking for TVM contributions - dm319 - 05-12-2024 06:58 PM

I've run out of TVM calculators.

Those of you who have calculators with TVM solvers, I'd be grateful if you could solve some TVM puzzles for me and see what results you are getting*.

The puzzles can be found here. Some of them require a bit more explanation (i.e. puzzle 2 is from here, and puzzle 4 requires inputting the PMT back in to then solving for i).

I'm particularly curious about other HP financial calculators from the HP-80 to the 12c and beyond, other user programs, and other puzzles that highlight other specific pitfalls of TVM solving.

*would like to know full internal precision if possible. Depending on the calculator, can be tricky, but use of `frac`, or subtracting part of the value so you can see the FP representation of the other digits can help.

another tip is to ensure everything is reset before moving onto the next problem.

EDIT: Redirect to one thread now.


RE: Looking for TVM contributions - Steve Simpkin - 05-12-2024 07:39 PM

As a tangentially related side note.

After improving the accuracy algorithms for HP's scientific calculations, Professor William Kahan discovered problems with the TVM financial calculations used in the HP-27 (and earlier financial models) that led to the internal recall of the HP-27 before the first one was even sold to the public.
From an interview with Professor William Kahan - August 2005:

KAHAN: "The first calculator that was doing what I said they should do was the HP-27, and they sent me a prototype that I could play with to see whether things were working out the way I said. Things were working out the way I said they would. The functions really did look a lot better. In fact, Dennis Harms actually wrote a little paper, I think, that got published in The HP Journal somewhere. But I was puzzled because on the top row of the calculator’s keyboard, they had these five keys: n, i, pv, pmt, and fe. I said, “And what do they do?” “Oh,” they said, “you don’t have to know that.” It was on a need-to-know basis, you see. So I looked at these things, and I finally figured out what they were doing. These for calculating the relationship among the interest rate, the initial loan value, a regular payment, like payment on a mortgage—the balloon payment, and the number of payments all totaled. That’s what it was supposed to do. It didn’t take me long to figure that out. I mean, after all, I had attended an actuarial science course in which such things were discussed, even if I had read in the back of the class. Then I said, “You know, if they’re going to compute the interest rate, that’s a non-trivial computation. I wonder if they can get it right.” And, of course, they couldn’t. So there were cases where I could see that, although it’s a ten-figure calculator, they’ve only got six figures correct of the interest rate. It didn’t take me long to find that. And I phoned my contact at Hewlett-Packard. I said, “Listen, I figured out what you’re doing here, but I’ve got to tell you, you’re losing digits. I’ve got this very simple example. It took me only a few moments to construct, and your interest rate is good to only six figures.” And the guy said, “Well, that’s okay; all we need is six figures.” I said, “Look, you’re going to lose more.” I found an example, and I called him up, and I said, “Look, here’s an example where you’ve lost all but four of your figures, and if you want to give me longer, I’ll find some where you lose them all.” But the fact that he had only four figures correct, that started to worry him. And I could hear the tone of his voice change—there were pauses. Then I said, “But you know, there is a way to do this that’ll get it right. And furthermore, it will liberate you from one of the constraints that you’ve put on the input data I see. That’s an unnecessary constraint.” And I described the algorithm to him, and then I sent him something. Yes, he microcoded it up, and he found the calculator worked faster for these interest rate calculations. The answer was just fine, right out to the last digit. And it didn’t have this unnecessary restriction, and everything about this was just marvelous except for one thing: they already had a warehouse full of these calculators in cartons with their manuals, ready to hit the Christmas market. What should they do? I was invited to a meeting, and David Packard was at the head of the table of this meeting. I didn’t have much to say. I didn’t have to because my views were being represented by one of these guys who said, “Our consultant found a bug. The bug appears to be serious. We found a way to repair the bug; the consultant provided that. All we have to do is replace ROMs. Unfortunately, that means we have to unsolder the old ROMs and solder new ROMs in. You can’t just do a plug-in, but we’ve got tools for doing that. What are we going to do with the thousands of boxes? Should we put them out on the market and insert a little slip into each one saying, ‘Sorry, there’s a little glitch, and if you send your calculator back, we’ll fix it’?”And David Packard said, “No, we’re not going to sell a defective product. It’s one thing to put them out on the market when we didn’t know there was a defect, and then later we have to chase down people. It’s something else to sell something when we know it’s defective.” And he said, “We will withdraw the calculators from the warehouse. We’ll make the necessary fix, change the ROMs, and so on. So we won’t make the Christmas market. We’ll have to go for the Easter market,” so to speak, or some other subsequent market. That shot my respect for David Packard up several notches. Now I knew he was a good guy. I knew he was technically competent. I knew that he ran a company based on what I would have to call humane principles. It wasn’t just good business. It was broadly humane. But he didn’t delay in that decision. It wasn’t as if it was an agonizing decision. It was clearly the proper decision. He made it there in my hearing, and I have to tell this story because there aren’t very many people who know it. And if you wonder why David Packard had earned the respect of so many of the people who knew him, this is another one of those stories. But in the meantime, I was in. From now on, I was participating in these calculators. That was all being done down in Cupertino. The next big task was going to be the HP-92."

The improved financial calculation algorithms that Professor Kahan developed for the HP-27 and HP-92 were carried on into the HP-12C and are still in use today, many decades later. They are one of the reasons the HP-12C is considered a de facto standard when it comes to TVM calculations.

A link to that interview with Professor William Kahan - August 2005:
https://drive.google.com/file/d/1Jlg9EWQEb4fNwBY8Zyu5ANKigpIzwcol


RE: Looking for TVM contributions - dm319 - 05-12-2024 08:00 PM

That's a fascinating story! I'm assuming those 'bugs' were also present on the HP-80, HP-70 and HP-22 then. So would be really interesting to see what kind of results people get from these devices and after.

Unfortunately the HP-80 failed at all the "solve for i" tests, so maybe we won't pick it up. There was a second part to problem 1 where we do a relatively easy solve for i, so maybe I'll integrate that into the answers.

Also, this is far cry from the HP more recently (referring to their practices around printer ink subscriptions).

EDIT: Also, strange to tell a consultant they don't need to know what a part of the calculator does, when you're asking them to test it!


RE: Looking for TVM contributions - Albert Chan - 05-12-2024 08:13 PM

Where can I read about Kahan's improved TVM (for rate) algorithm?


RE: Looking for TVM contributions - dm319 - 05-12-2024 08:48 PM

(05-12-2024 08:13 PM)Albert Chan Wrote:  Where can I read about Kahan's improved TVM (for rate) algorithm?

Look here! I even mention in that thread that you would have found the article interesting!

The link seems to be down see this HP Journal 1977 issue 10. Though actually, this is about the HP-92, so not sure it it's talking about the changes implemented into the HP-27 given it came out a year after.


RE: Looking for TVM contributions - dm319 - 05-12-2024 08:49 PM

(05-12-2024 07:39 PM)Steve Simpkin Wrote:  “Look, here’s an example where you’ve lost all but four of your figures, and if you want to give me longer, I’ll find some where you lose them all.”

Ok, I've added an easier example solving for i, to give the HP-80 a chance, and indeed, it appears to get it right down to 4 decimal points.


RE: Looking for TVM contributions - Steve Simpkin - 05-12-2024 09:01 PM

(05-12-2024 08:48 PM)dm319 Wrote:  
(05-12-2024 08:13 PM)Albert Chan Wrote:  Where can I read about Kahan's improved TVM (for rate) algorithm?

Look here! I even mention in that thread that you would have found the article interesting!

The link seems to be down see this HP Journal 1977 issue 10. Though actually, this is about the HP-92, so not sure it it's talking about the changes implemented into the HP-27 given it came out a year after.

Use these links instead.

The Oct 1977 issue of HP Journal magazine describes the improved TVM solver user interface of the HP-92 Financial Printing desktop calculator in detail (magazine page 22, PDF page 34). This appears to be the final user interface iteration that is used on the HP-12C. It appears to also discuss some of the improvements made in the algorithms. A PDF of this issue is available here:
http://hparchive.com/Journals/HPJ-1977-10.pdf

There is also an article by Dennis Harms ("The New Accuracy: Making 2 to the third = 8") in the Nov 1976 issue of HP Journal magazine that discusses how HP implemented an improved accuracy for certain functions. A PDF of this issue is available here:
http://hparchive.com/Journals/HPJ-1976-11.pdf


RE: Looking for TVM contributions - dm319 - 05-14-2024 11:04 AM

Is there anyone up for trying these problems on their financial calculator? Or else I'm going to have to build up my collection and will be very costly on my finances and spousal relationship.

Would be curious if anyone has the HP-80, HP-70, HP-22, HP-27, HP-37E, original HP-12c, HP-18c, HP-17B and HP-10Bii/17Bii to see how these fare. I'm curious to see if we can see the underlying algorithm changing, but maybe this is a very niche curiosity.


RE: Looking for TVM contributions - Dave Britten - 05-14-2024 12:00 PM

For the sake of comparison, here's what I got for all 9 of them on my Casio FC-200 (the old one, not the newer FC-200V):

1: -1368.148355
1b: 0.3644348644
2: -1264.444022 -> -1028.612597
3: 331667.0067
4: -208.3333333 -> -8.316008316E-013
5: ERROR
6: ERROR
7: 2.181818182E-10
8: 3.125E-6


RE: Looking for TVM contributions - AndiGer - 05-14-2024 03:28 PM

(05-14-2024 11:04 AM)dm319 Wrote:  Would be curious if anyone has the HP-80, HP-70, HP-22, HP-27, HP-37E, original HP-12c, HP-18c, HP-17B and HP-10Bii/17Bii to see how these fare. I'm curious to see if we can see the underlying algorithm changing, but maybe this is a very niche curiosity.

Did you intentionally leave out the HP-92?
Andi


RE: Looking for TVM contributions - dm319 - 05-14-2024 05:58 PM

(05-14-2024 03:28 PM)AndiGer Wrote:  Did you intentionally leave out the HP-92?
Andi

My bad! I'm also very curious about other makes too, modern also.


RE: Looking for TVM contributions - dm319 - 05-14-2024 05:59 PM

(05-14-2024 12:00 PM)Dave Britten Wrote:  For the sake of comparison, here's what I got for all 9 of them on my Casio FC-200 (the old one, not the newer FC-200V):

Thank you! I'll add this to my table, and I think I'll post a table here (actually, is that possible in this forum?) with a summary of results.


RE: Looking for TVM contributions - dm319 - 05-14-2024 08:31 PM

Ok these are the current rankings.
More results are very warmly welcome!

Code:

| calculator      | 1   | 1b  | 2   | 3   | 4   | 5   | 6   | 7   | 8   |
|-----------------|-----|-----|-----|-----|-----|-----|-----|-----|-----|
| Plus42 1.1.9    | -29 | -32 | -28 | -18 | -∞  | -30 | -31 | -26 | -35 |
| NSTK TVM V5     | -29 | -30 | -28 | -18 | -10 | -30 | -31 | -19 | -30 |
| TI-83 Plus      | -10 | -12 | -8  | -7  | -∞  | -11 | -11 | -19 | -18 |
| RPN83P v0.9.0   | -9  | -12 | -9  | -7  | -∞  | ERR | ERR | -11 | -12 |
| HP-12cp         | -8  | -10 | -6  | -6  | -13 | ERR | ERR | -21 | -11 |
| Casio FC-200    | -6  | -8  | NA  | -4  | -13 | ERR | ERR | -19 | -9  |
| HP-80 (HP-1973) | -6  | -4  | -5  | 5   | ERR | ERR | ERR | ERR | ERR |

I have shown the exponent value to which the result is congruent with the most accurate result. I.e. -5 means it is accurate to 0.00001 and 3 means accurate to nearest 1000. I'm thinking there are other metrics - ergonomics, preference for returning a positive I%YR, or ability to return an I%YR result without providing guesses, and ability to fail gracefully for unsolvable problems, but these are more subjective, so will leave that for the moment.

EDIT1: used some adapted plus42 code running in arbitrary precision in R using the Rmpfr package as a source of truth. This has boosted the numbers for Plus42 further!


RE: Looking for TVM contributions - dm319 - 05-14-2024 08:34 PM

Sorry to trouble you Dave, but could you try these two again for me?
(05-14-2024 12:00 PM)Dave Britten Wrote:  1b: 0.3644348644
would you mind giving me this result multiplied by 12? We might get an extra digit of accuracy.
(05-14-2024 12:00 PM)Dave Britten Wrote:  2: -1264.444022 -> -1028.612597
could you subtract these from each other, then put that in as PMT, with I%=15%, and N=36? should give around 6800.


RE: Looking for TVM contributions - Albert Chan - 05-14-2024 10:38 PM

(05-14-2024 08:31 PM)dm319 Wrote:  Also, difficult to know what to do exactly when there are two answers.
Does anyone know of an arbitrary precision TVM calculator?

No need. All you need is to test for round-trip.


RE: Looking for TVM contributions - JoJo1973 - 05-15-2024 07:23 AM

(05-14-2024 08:31 PM)dm319 Wrote:  Does anyone know of an arbitrary precision TVM calculator? I tried some websites, gnome-calculator, and wolfram alpha but can't find anything appropriate yet.

HP-50+newRPL has 2000 digits and a TVM solver, give it a try!


RE: Looking for TVM contributions - dm319 - 05-15-2024 12:57 PM

(05-15-2024 07:23 AM)JoJo1973 Wrote:  HP-50+newRPL has 2000 digits and a TVM solver, give it a try!

Oh wow, how has that been managed - that's impressive! Are you using arbitrary precision?

I had a go last night adapting the plus42 code into R and using the Rmpfr package which has arbitrary precision. The weird thing is though that I'm not getting good precision. A lot of decimal places, but precision is only around 14 digits for calculating i which is weird, and I don't know why*.

*spoke too soon. I stupidly did a divide by 12 before using the type! I think I now have an arbitrary precision calculator, which looks like it will show plus42 is getting the best accuracy.


RE: Looking for TVM contributions - dm319 - 05-15-2024 01:00 PM

(05-14-2024 10:38 PM)Albert Chan Wrote:  No need. All you need is to test for round-trip.

Thanks Albert, but I'm not sure how you infer which digits are accurate?


RE: Looking for TVM contributions - JoJo1973 - 05-15-2024 02:39 PM

(05-15-2024 12:57 PM)dm319 Wrote:  
(05-15-2024 07:23 AM)JoJo1973 Wrote:  HP-50+newRPL has 2000 digits and a TVM solver, give it a try!

Oh wow, how has that been managed - that's impressive! Are you using arbitrary precision?

It's not my project, it's Claudio Lapilli's! However, yes it implements arbitrary precision.

You are not forced using all 2000 digits however... actual precision is user selectable. When using full 2000 digits you have 16 hidden guard digits.


RE: Looking for TVM contributions - dm319 - 05-24-2024 11:22 AM

Just to update with some more data.

Code:
| calculator    | year | 1   | 1b  | 2   | 3   | 4   | 5   | 6   | 7   | 8   |
|---------------|------|-----|-----|-----|-----|-----|-----|-----|-----|-----|
| Plus42 1.1.9  | 2022 | -29 | -32 | -28 | -18 | -∞  | -30 | -31 | -26 | -35 |
| NSTK TVM V5   | 2023 | -29 | -30 | -28 | -18 | -10 | -30 | -31 | -19 | -30 |
| TI-83 Plus    | 1999 | -10 | -12 | -8  | -7  | -∞  | -11 | -11 | -19 | -18 |
| RPN83P v0.9.0 | 2023 | -9  | -12 | -9  | -7  | -∞  | ERR | ERR | -11 | -12 |
| HP-12cp       | 2003 | -8  | -10 | -6  | -6  | -12 | ERR | ERR | -21 | -11 |
| HP-17BII      | 1990 | -8  | -10 | -6  | -6  | -12 | ERR | ERR | -11 | -11 |
| HP-20b⁴       | 2008 | -8  | -10 | -6  | -6  | -12 | ERR | ERR | -11 | -11 |
| HP-30b⁴       | 2010 | -8  | -10 | -6  | -6  | -12 | ERR | ERR | -11 | -11 |
| Casio FC-200  | 1992 | -6  | -8  | NA  | -4  | -13 | ERR | ERR | -19 | -9  |
| HP-92³        | 1977 | -6  | -8  | -4  | -4  | -∞  | ERR | ERR | -9  | -9  |
| HP-12c⁴       | 1981 | -6  | -8  | -4  | -4  | -10 | ERR | ERR | -9  | -11 |
| HP-37E¹       | 1978 | -6  | -8  | -4  | -4  | -9  | ERR | ERR | -9  | -9  |
| HP-38E¹       | 1978 | -6  | -8  | -4  | -4  | -9  | ERR | ERR | -9  | -9  |
| HP-27¹        | 1976 | -6  | -9  | -4  | -3  | -9  | ERR | ERR | ERR | ERR |
| HP-22¹        | 1975 | -6  | -8  | -4  | -3  | -9  | ERR | ERR | ERR | ERR |
| HP-70¹        | 1974 | -5  | -6  | -4  | 5   | -9  | ERR | ERR | ERR | ERR |
| HP-80²        | 1973 | -6  | -4  | -5  | 5   | ERR | ERR | ERR | ERR | ERR |

I've used a combination of contributions and emulated data. It is interesting to see the progression of the accuracy, with more capability of the calculators to solve particular types of problems as the algorithm is improved. It was also interesting to see the huge UI improvements over time, with the HP-92 essentially landing on the peak UI style, where you can chain calculations easily, and it adopts the modern sign conventions.