[WP34s] new TVM-solver version « Next Oldest | Next Newest »

 ▼ fhub Posting Freak Posts: 1,216 Threads: 75 Joined: Jun 2011 05-10-2012, 12:34 PM 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. ▼ Paul Dale Posting Freak Posts: 3,229 Threads: 42 Joined: Jul 2006 05-11-2012, 06:20 AM Can we include this updated version in the 34S library? - Pauli ▼ fhub Posting Freak Posts: 1,216 Threads: 75 Joined: Jun 2011 05-11-2012, 08:07 AM Quote: Can we include this updated version in the 34S library? Of course. ;-) Franz ▼ Marcus von Cube, Germany Posting Freak Posts: 3,283 Threads: 104 Joined: Jul 2005 05-11-2012, 10:31 AM Thanks, I'll replace it with the next update. Artur-Brazil Member Posts: 127 Threads: 21 Joined: Jul 2006 05-11-2012, 08:12 AM 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. ▼ fhub Posting Freak Posts: 1,216 Threads: 75 Joined: Jun 2011 05-11-2012, 08:41 AM 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 ▼ Marcus von Cube, Germany Posting Freak Posts: 3,283 Threads: 104 Joined: Jul 2005 05-11-2012, 10:49 AM The program size isn't a problem with the WP 34S because it has enough library space. Safe algorithms are much more relevant. fhub Posting Freak Posts: 1,216 Threads: 75 Joined: Jun 2011 05-11-2012, 08:33 AM 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. ▼ Marcus von Cube, Germany Posting Freak Posts: 3,283 Threads: 104 Joined: Jul 2005 05-11-2012, 11:00 AM Good point! I'll check where the ENTRY flag gets (re)set. ▼ fhub Posting Freak Posts: 1,216 Threads: 75 Joined: Jun 2011 05-11-2012, 11:08 AM 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. ;-) ▼ Walter B Posting Freak Posts: 4,587 Threads: 105 Joined: Jul 2005 05-11-2012, 12:50 PM 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. ▼ fhub Posting Freak Posts: 1,216 Threads: 75 Joined: Jun 2011 05-11-2012, 01:10 PM 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? :-) ▼ Walter B Posting Freak Posts: 4,587 Threads: 105 Joined: Jul 2005 05-11-2012, 02:22 PM 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. ▼ fhub Posting Freak Posts: 1,216 Threads: 75 Joined: Jun 2011 05-11-2012, 04:44 PM 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. Marcus von Cube, Germany Posting Freak Posts: 3,283 Threads: 104 Joined: Jul 2005 05-11-2012, 03:21 PM Franz, can you try again with the latest build? ▼ fhub Posting Freak Posts: 1,216 Threads: 75 Joined: Jun 2011 05-11-2012, 04:21 PM 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. ▼ Marcus von Cube, Germany Posting Freak Posts: 3,283 Threads: 104 Joined: Jul 2005 05-12-2012, 01:51 AM 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. ▼ fhub Posting Freak Posts: 1,216 Threads: 75 Joined: Jun 2011 05-12-2012, 04:23 AM 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. ▼ Dominic Richens Member Posts: 228 Threads: 7 Joined: Aug 2011 05-12-2012, 01:32 PM 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. ▼ fhub Posting Freak Posts: 1,216 Threads: 75 Joined: Jun 2011 05-12-2012, 01:45 PM 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. ▼ Dominic Richens Member Posts: 228 Threads: 7 Joined: Aug 2011 05-13-2012, 07:58 AM 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. ▼ fhub Posting Freak Posts: 1,216 Threads: 75 Joined: Jun 2011 05-13-2012, 08:01 AM 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? ;-) fhub Posting Freak Posts: 1,216 Threads: 75 Joined: Jun 2011 05-12-2012, 11:43 AM 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. ▼ Walter B Posting Freak Posts: 4,587 Threads: 105 Joined: Jul 2005 05-12-2012, 12:47 PM We came across this ample dot matrix more than a few times ;-) ▼ fhub Posting Freak Posts: 1,216 Threads: 75 Joined: Jun 2011 05-12-2012, 12:58 PM 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. ▼ Walter B Posting Freak Posts: 4,587 Threads: 105 Joined: Jul 2005 05-12-2012, 01:15 PM 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. Alexander Oestert Senior Member Posts: 429 Threads: 31 Joined: Jul 2011 05-12-2012, 01:35 PM why not try 'n i PV Pm FV' or 'n i PV Pt FV'? ▼ fhub Posting Freak Posts: 1,216 Threads: 75 Joined: Jun 2011 05-12-2012, 01:42 PM 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). ▼ Alexander Oestert Senior Member Posts: 429 Threads: 31 Joined: Jul 2011 05-13-2012, 03:16 AM 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. ▼ fhub Posting Freak Posts: 1,216 Threads: 75 Joined: Jun 2011 05-13-2012, 05:42 AM 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 5,608 12-10-2013, 03:25 AM Last Post: fabrice48 HP Prime Triangle solver BruceH 29 5,817 11-28-2013, 12:03 AM Last Post: Dale Reed Using units in Numeric Solver Harold A Climer 1 859 10-13-2013, 10:44 AM Last Post: Tim Wessman Does Prime Have a Multiple Equation Solver? Norman Dziedzic 2 947 09-20-2013, 09:43 AM Last Post: Norman Dziedzic TVM again ;-) fhub 17 3,547 09-02-2013, 11:03 AM Last Post: fhub New version of WP34s iOS emulator pascal_meheut 4 1,349 07-22-2013, 03:55 PM Last Post: Matt Agajanian Just a lazy solver algortihm PGILLET 1 795 06-28-2013, 11:47 PM Last Post: Namir TVM WP34s trouble Jim P 4 1,309 06-28-2013, 07:31 AM Last Post: fhub New version of the WP34s iOS emulator pascal_meheut 15 2,768 04-23-2013, 01:58 AM Last Post: Walter B [43s] : How the solver will be implemented Miguel Toro 3 1,135 03-14-2013, 06:09 PM Last Post: Walter B

Forum Jump: