[WP34s] new TVM-solver version



#2

Here's a new version of my TVM solver:

http://www.hpmuseum.org/guest/fhub/tvm.zip

I've fixed the bug with the wrong initial guesses for the SLV routine, increased both values to allow for a wider range for the interest rate 'I', and made an additional routine for 'I' when PMT=0 (so the solver SLV is only used when really necessary).

This version should now work indeed for all (usual) interest rates - at least as long as the WP34s solver SLV agrees with me (and my code). ;-)

Franz

Edited: 10 May 2012, 12:44 p.m.


#3

Can we include this updated version in the 34S library?


- Pauli


#4

Quote:
Can we include this updated version in the 34S library?

Of course. ;-)

Franz


#5

Thanks, I'll replace it with the next update.

#6

Hi!

May I ask: do you make one equation for calculating each parameter?

If so, I remember I used, in my old 15C, the indirect store and recall address (I). So, I put on I the number of register I would like to compute (0 -> i; 1 - n; 2 - PV ...) and used the Solve to find the value that makes the TVM equation gives 0. At the beginning of solver's function (the TVM function), I store the guess on the (i) register and let the function calculates its value, so Solve took it and iterate over and over until 0 was reached. It was a very short program.
I thought I had take this idea from 15C Advanced, but it uses a similar way you have used.

Best regards,
Artur

Edited: 11 May 2012, 8:14 a.m.


#7

Quote:
May I ask: do you make one equation for calculating each parameter?

Hi Artur.

No, I only use the internal WP34s solver (SLV) for the one case when it's absolutely necessary, that is when you calculate I (and PMT!=0).

In all other cases I use direct formulas for each variable - of course this makes the program much bigger, but it's more safe because there's no guarantee that the solver SLV will find a solution for every problem.

Franz


#8

The program size isn't a problem with the WP 34S because it has enough library space. Safe algorithms are much more relevant.

#9

In trying to make a new key-handling for another TVM version I've run into the following problem (with the ENTRY? command):

One thing I never liked with my TVM solver is that it doesn't have the usual key-layout "N I PV PMT FV" with these 5 keys in a single row, because the WP34s has only 4 user-keys.

So I've tried another solution with the user-key [A] as prefix, and then pressing [A]..[->] to get those 5 possible functions.

(e.g. [A][A] is N, and [A][->] is FV, etc.)

With the command KEY? this is in principle no problem, but unfortunately the program doesn't work as expected - it just doesn't make any difference if the user had previously entered any number (before calling one of these function-keys) or not. It seems that ENTRY? doesn't work anymore when using KEY?, but I have no explanation for this behaviour!?

Here's the code (only for the 'N' key, all other functions are identical):

015 LBL 00	// return after input or calculation
016 FS?C 00
017 SKIP 003
018 RCL- X
019 FILL // remove intermediate results
020 RCL L
021 STOP // wait for input or calculation
022 BACK 001 // [R/S] -> clears ENTRY? flag

023 LBL A // prefix [A]
024 CL[alpha]
025 [alpha]'N[space]I'
026 [alpha]'[space]PV'
027 [alpha] [space]
028 [alpha]'PMT'
029 [alpha]'[space]FV'
030 VIEW[alpha]
031 PSE 99
032 KEY? 00
033 BACK 003
034 LBL?[->]00
035 XEQ[->]00
036 GTO 00

037 LBL 11
038 ENTRY?
039 SF 00
040 FC? 00
041 XEQ 01
042 STO 01
043 CL[alpha]
044 [alpha]'N='
045 VW[alpha]+ 01
046 RTN

If I enter any number and press [A][A] then this number is stored in R01 and N is not calculated (which is ok).

But also if I don't enter any number (also after a R/S in line 021/022 which should reset the ENTRY? flag), N is not calculated but just stored again, i.e. XEQ 01 in line 041 is never executed although without any number entry it should be!?

So it seems KEY? (or maybe PSE or any other command) is setting the ENTRY? flag without having in fact entered anything.

Since I don't see any logical mistake in my code above, maybe it's a bug in the KEY? command?

(the official TVM version is working correctly without this ENTRY? problem)

Franz

Edited: 11 May 2012, 10:36 a.m.


#10

Good point! I'll check where the ENTRY flag gets (re)set.


#11

Quote:
Good point! I'll check where the ENTRY flag gets (re)set.

Ok, it's really necessary that this method with KEY? works, because this is the only way I can imagine to get 5 or 6 'pseudo' user-keys.

Well, at least unless you'll implement 5 or 6 user-keys natively in the WP34s - a long dream of mine. ;-)


#12

Quote:
unless you'll implement 5 or 6 user-keys natively in the WP34s - a long dream of mine.

This will happen with the 43S, not earlier.

#13

Quote:
This will happen with the 43S, not earlier.

And what about a FKEYS4/FKEYS6 mode setting (like SSIZE4/SSIZE8), where the 2 keys [->] and [CPX] are turned into user-keys [E] and [F] when in FKEYS6 mode? :-)

#14

You know why it's called WP 34S, don't you? I admit I voted for including a small TVM application many months ago since it's the one financial app an engineer may use most - but it shall not take over the calculator. If you want a financial calc, take a 30b or 17bii+ or 12C, please. I see no need to reinvent the wheel here.

My 20m€ - YMMV.


#15

Quote:
You know why it's called WP 34S, don't you?

Damned, I always thought this S would be a $, and thus the WP34$ would be a financial calculator! ;-)

But reading all those postings about 'improving' the distribution formuals from 34 to 39 digits, now I rather think this S stands for Statistics. ;-)

Franz

Edited: 11 May 2012, 4:51 p.m.

#16

Franz, can you try again with the latest build?


#17

Yes Marcus, now it works as expected! :-)

(I guess the problem was rather the PSE command than the KEY?, right?)

Thanks for fixing,

Franz

BTW, what do you think about this method of using [A] as prefix and then being able to have more than 4 user keys with this KEY? command?

Would it be worth to make such a TVM version public?

It's a pity that in your keyboard layout both keys [->] and [CPX] in the upper row aren't swapped - if they were than we could access at least 5 consecutive user-labels with [XEQ] and [A]..[CPX] and I won't need this trick with the prefix [A]. But unfortunately [XEQ][->] doesn't work (as XEQ 14) because it means indirect XEQ.

Edited: 11 May 2012, 4:24 p.m.


#18

I leave the comments to others who actually use TVM. I'm undecided. The nice thing is that you can show a short menu which is not possible with the XEQ approach. BTW, try XEQ f ->. :-)

The alpha entry was the problem. It set the entry flag within the program which is undesirable. I changed it to respect being executed by a running program as an exception.


#19

Quote:
The nice thing is that you can show a short menu which is not possible with the XEQ approach.

Yes, but the not so nice thing is that "N I PV PMT FV" is just one letter too long for the alpha-display. :-(

(I've tried [narrow-space] between the letters, but that doesn't look pretty, too)
Quote:
BTW, try XEQ f ->. :-)

I know, but that's even one keystroke ([f]) more - and such an exception for only one key (when for all others XEQ is enough) is never good.

Franz


Edited: 12 May 2012, 4:24 a.m.


#20

Franz,

You can always drop the M or T from PMT - a bit none standard but by process of elimination we know what "PM" or "PT" means.

Excellent idea, BTW.


#21

Quote:
You can always drop the M or T from PMT - a bit none standard but by process of elimination we know what "PM" or "PT" means.

Yes Dominic, possible but looking everything else than pretty (IMO).

But of course if anyone prefers this version (with the 5 keys in a row) he can easily change this 'menu' to whatever he wants by adding a few [alpha] lines. :-)

And BTW, such a full menu would be much more useful if it would correctly be displayed 'above' the function keys. But I doubt that it would be possible in a program to show text on the 'number' display, at least I'm not aware of such a command.

Edited: 12 May 2012, 1:53 p.m.


#22

I will use it for a bit and see.

If anything it helps me remember the order of the function keys.

Edited: 13 May 2012, 7:58 a.m.


#23

Quote:
I will use it for a bit and see.

If anything it helps me remember the order of the function keys.


Looks nice!

Does this "PM" key send a PM (private message) to me? ;-)

#24

Here's an alternate version of my TVM solver:

http://www.hpmuseum.org/guest/fhub/tvm_5.zip

It uses a different keyboard layout which is similar to the usual financial calculators with their "N I PV PMT FV" keys.

With this version the user-key [A] works as prefix when pressed the first time. The WP34s then displays "Fn?" in the alpha-line and waits for an other keypress, and this 2nd key is now one of the 5 top-row keys [A]..[D] and [->], or [STO] and [RCL].

Pressing any other key (or none at all within 10 seconds) when "Fn?" is displayed the WP34s returns to its usual state.

And you can see if the following function-key just stores your value or if this value will be calculated ('- - -' in the display if you didn't enter any value).

The layout for this 2nd key (after the prefix [A]) is:

  N      I    PV    PMT    FV
[A] [B] [C] [D] [->]

NP NI
[STO] [RCL]

Otherwise there's no difference at all to the previous (official) version in the calculation code, so chose whatever version you prefer. ;-)

Franz

PS: It would of course be much prettier to display "N I PV PMT FV" as menu (instead of "Fn?"), but unfortunately this string is just one character too long for the alpha-line. :-(


Edited: 12 May 2012, 12:01 p.m.


#25

We came across this ample dot matrix more than a few times ;-)


#26

I hope your next project (the WP43S) will have at least a 4-inch dot-matrix display - and of course an additional QWERTY keyboard - and a CAS - and a natural language I/O - and ... ;-)

In short words: eine Eier-legende Wollmilchsau! (sorry, I don't know if such an animal exists in English language ;-))

Edited: 12 May 2012, 1:04 p.m.


#27

Quote:
eine Eier-legende Wollmilchsau!

Such animals are dangerous (for spelling, too - shoot "neue deutsche Rechtschreibung"!) ;-)

In fact, I'm not so keen on large displays - the minimum I really really want is a dot matrix as in the HP-42S. Anything better is appreciated (and will look good) but not required. If pocketability would suffer due to a large display I'd cut the display. YMMV


Edited: 12 May 2012, 1:17 p.m.

#28

why not try 'n i PV Pm FV' or 'n i PV Pt FV'?


#29

Quote:
why not try 'n i PV Pm FV' or 'n i PV Pt FV'?

Well, an abbreviation PM or PT for PMT would work, but this really looks ugly in my opinion.

And using lowercase letter won't work I'm afraid, because all characters have the same width (I've even tried a dot '.' between, but this didn't work, too).


#30

Quote:

And using lowercase letter won't work...


I didn't use lower case for width reasons, but for consistency and logic. In the 12C's manual, n and i are lower case. In PV and FV the capital letter V stands for its own new word. On the other hand, 'Pmt' is just the abbreviation of one single word, the 'mt' part being taken from inside the word 'payment'. In my opinion it would be misleading to abbreviate them with upper case letters.

Concerning how 'Pm' or 'Pt' looks I won't argue, that's a matter of personal taste.


#31

Quote:
I didn't use lower case for width reasons, but for consistency and logic. In the 12C's manual, n and i are lower case. In PV and FV the capital letter V stands for its own new word.

I don't see any "consistency and logic" in using capital letters for PV and FV, but at the same time lowercase letters for n and i!?

And BTW, I just saw that even HP uses N and I/YR in their HP-20b.
Quote:
On the other hand, 'Pmt' is just the abbreviation of one single word, the 'mt' part being taken from inside the word 'payment'. In my opinion it would be misleading to abbreviate them with upper case letters.

Well, then you should tell this HP, because even they use the "misleading" PMT in their financial calcs. ;-)

Franz


Edited: 13 May 2012, 6:38 a.m.


Possibly Related Threads...
Thread Author Replies Views Last Post
  hp-prime solver and variable name fabrice48 22 1,997 12-10-2013, 03:25 AM
Last Post: fabrice48
  HP Prime Triangle solver BruceH 29 2,079 11-28-2013, 12:03 AM
Last Post: Dale Reed
  Using units in Numeric Solver Harold A Climer 1 291 10-13-2013, 10:44 AM
Last Post: Tim Wessman
  Does Prime Have a Multiple Equation Solver? Norman Dziedzic 2 326 09-20-2013, 09:43 AM
Last Post: Norman Dziedzic
  TVM again ;-) fhub 17 1,189 09-02-2013, 11:03 AM
Last Post: fhub
  New version of WP34s iOS emulator pascal_meheut 4 513 07-22-2013, 03:55 PM
Last Post: Matt Agajanian
  Just a lazy solver algortihm PGILLET 1 297 06-28-2013, 11:47 PM
Last Post: Namir
  TVM WP34s trouble Jim P 4 520 06-28-2013, 07:31 AM
Last Post: fhub
  New version of the WP34s iOS emulator pascal_meheut 15 1,091 04-23-2013, 01:58 AM
Last Post: Walter B
  [43s] : How the solver will be implemented Miguel Toro 3 427 03-14-2013, 06:09 PM
Last Post: Walter B

Forum Jump: