Plus42 Equations, Preview Release

06122022, 08:50 AM
Post: #741




RE: Plus42 Equations, Preview Release
(06122022 07:26 AM)Ajaja Wrote: By the way, I find it very convenient to see simultaneously all values (#P, Interest, Principal, Balance) in the top display rows. Yes, I recently added a new function, XVIEW, to help with that. XVIEW works like AVIEW, except it takes the text from a string in the X register, instead of the alpha register, so you don't have the 44character length limit. 

06122022, 09:12 AM
Post: #742




RE: Plus42 Equations, Preview Release
For example, to view A, B, and C simultaneously:
Code: 00 { 46Byte Prgm } 

06122022, 09:20 AM
Post: #743




RE: Plus42 Equations, Preview Release
Thanks! Works great with "Line Feed" symbol


06122022, 03:29 PM
(This post was last modified: 06122022 03:37 PM by Ajaja.)
Post: #744




RE: Plus42 Equations, Preview Release
Playing with equations I found some strange behavior of Plus42 solver. Looks like the iterative search uses old (previous) initial value of variables, not values entered in CALC mode using the interactive menu:
Code:


06122022, 05:05 PM
Post: #745




RE: Plus42 Equations, Preview Release
The solver uses two starting values, not one, and in the scenario you described, you're only providing one starting value. This means that the other starting value will be the previous value of the parameter, which in this case is a root.
To prevent the solver from just dropping straight back on the previous root, be sure to provide two starting values. If you only have one, just enter it twice, for example, 0 STO "X" ENTER STO "X" SOLVE "X" (0 X ENTER X X). 

06122022, 06:57 PM
(This post was last modified: 06122022 11:01 PM by Ajaja.)
Post: #746




RE: Plus42 Equations, Preview Release
Understood. Sorry for newbie questions. I've never used such "equation/solver" approach for programming before and wasn't able to find old HP calculators ROMs to check in Emu42 if it's my misunderstanding of how it should work or a real bug.
I've just started to read "StepbyStep Solutions: Technical Applications (27S/19B)" about this topic, it's really fascinating 

06122022, 07:28 PM
Post: #747




RE: Plus42 Equations, Preview Release
The thing with the two starting guesses is how the original HP solver works as well. I'd recommend taking a look at the HP42S manual, chapter 12, to get started with using the solver with programs, and the HP17B or 19B manuals to get started with using the solver with equations. There are links to all of these manuals on my web site; see the Free42 page for the HP42S manual, and the Plus42 page for the 17B and 19B manuals:
https://thomasokken.com/free42/#manual https://thomasokken.com/plus42/#equations 

06122022, 10:35 PM
Post: #748




RE: Plus42 Equations, Preview Release
Hi,
when i'm in the BASE menu, switch to e.g. BINM and enter a invalid number (e.g. 2) and then press '<' the application crashes (tested on Android and Linux). In Free42 the wrong inputs are just ignored. 

06122022, 10:47 PM
Post: #749




RE: Plus42 Equations, Preview Release
Noted! Will fix in the next release.


06132022, 01:27 AM
Post: #750




RE: Plus42 Equations, Preview Release
(06122022 06:57 PM)Ajaja Wrote: ... Ajaja, As a quick note, here is a post from the author of that book, Steve Sabin, on his experiences writing it. https://www.hpmuseum.org/forum/thread15...#pid149679 

06162022, 03:20 PM
Post: #751




RE: Plus42 Equations, Preview Release
I'm trying to use named equations recursively in Plus42 v1.0.7 but found that they EVAL very slow. Or maybe I'm doing something wrong.
My test equation is "FIB(N):IF(N≤1:N:FIB(N2)+FIB(N1))" and it takes significant amount of time to calculate even for N=30 on my smartphone. Printer is OFF. Any hints/suggestions? (06132022 01:27 AM)Steve Simpkin Wrote: Ajaja,Thanks 

06162022, 04:00 PM
Post: #752




RE: Plus42 Equations, Preview Release
(06162022 03:20 PM)Ajaja Wrote: I'm trying to use named equations recursively in Plus42 v1.0.7 but found that they EVAL very slow. Or maybe I'm doing something wrong. The number of evaluations of FIB grows exponentially with N. For N=30, FIB is called 2,692,537 times. It could be sped up a lot using memoization... 

06162022, 04:27 PM
(This post was last modified: 06162022 05:42 PM by Ajaja.)
Post: #753




RE: Plus42 Equations, Preview Release
Yes, I gravely underestimated the scale of the recursion. Just tested, the similar keystroke program works only 1020% faster:
Code: 00 { 33Byte Prgm } P.S. With memorization it's MUCH faster Code: FIB(N):0*IF(MAT?(M):0:MROWS(L(M:NEWMAT(N:1))))+0*IF(MROWS(M)<N:MROWS(L(M:NEWMAT(N:1))):0)+IF(N≤1:N:IF(M[N:1]=0:L(M[N:1]:FIB(N2)+FIB(N1)):M[N:1])) 

06162022, 05:48 PM
Post: #754




RE: Plus42 Equations, Preview Release
(06082022 12:46 PM)Thomas Okken Wrote: there is a bug in PMT. In BEGIN mode, it should divide the calculated value by 1+i There is an intuitive way to get the correct factor. Think of n+1 cash flows. BEGIN mode ⇒ [pv + pmt, pmt, pmt, ..., pmt, fv] This is equivalent to all payments paid late 1 period, with a bit of interest penalty. END mode ⇒ [pv, pmt*(1+i), pmt*(1+i), ... pmt*(1+i), fv + pmt*(1+i)] Shifted to END mode, we are really solving for pmt*(1+i) To recover payment, BEGIN mode, we *divide* by (1+i) 

06162022, 08:07 PM
(This post was last modified: 06162022 08:09 PM by Ajaja.)
Post: #755




RE: Plus42 Equations, Preview Release
BTW, HP calculators have some peculiarity with calculation of amortization when balance changes sign. At first, comparing results, I thought that Plus42 fails to calculate Interest parameter in AMORT program properly, but after some considerations I realized that HP17b/19b/27s AMORT program does it mathematically wrong.
There is an example (look at "Interest"): HP17bII Code: I%YR= 10.00 Plus42: Code: I%YR= 10.00 

06172022, 08:59 AM
(This post was last modified: 06172022 08:59 AM by Vincent Weber.)
Post: #756




RE: Plus42 Equations, Preview Release
Yes, we had this interesting discussion with Thomas when he implemented TVM... And actually he is right and HP is wrong
One small difference though, if you set up the amortization table parameters (FIRST, LAST, INC), and exit TVM app and come back, these parameters are gone in both Plus42 and the HP27S, but on Plus42 the number of payments is reset to 0, whereas on the 27S it is reset to 1, hence you get something (1 entry) if you press "GO". Thomas, is this intended ? Cheers 

06172022, 09:59 AM
Post: #757




RE: Plus42 Equations, Preview Release
(06172022 08:59 AM)Vincent Weber Wrote: Yes, we had this interesting discussion with Thomas when he implemented TVM... And actually he is right and HP is wrong So this brings up the question: Do we want mathematically correct behavior or do we want HP compatibility? Tom L Cui bono? 

06172022, 10:36 AM
Post: #758




RE: Plus42 Equations, Preview Release
(06172022 09:59 AM)toml_12953 Wrote:(06172022 08:59 AM)Vincent Weber Wrote: Yes, we had this interesting discussion with Thomas when he implemented TVM... And actually he is right and HP is wrong IMHO, given that Plus42  is a unique&peculiar calculator  has few chances to move to a physical platform  and considering that the original 42s had no TVM feature to preserve compatibility with i would want a correct mathematical behavior. Even the other new features (Units, Algebraic equation solver, etc) should, IMHO, be free to evolve even losing the compatibility with the original HP concept. Just my two cents 

06172022, 10:49 AM
Post: #759




RE: Plus42 Equations, Preview Release
The assumption that I would question is that HP is wrong. TVM calculations on the 12C have been proven to be robust by multiple institutions and individuals (within the confines of the calculator's precision).
HP wouldn't continue to sell the 12C 40 years down the line if it had missioncritical errors. 

06172022, 10:52 AM
Post: #760




RE: Plus42 Equations, Preview Release
I notice that 12C isn't listed among the accused:
> after some considerations I realized that HP17b/19b/27s AMORT program does it mathematically wrong. Is that important? Does the 12C do differently? 

« Next Oldest  Next Newest »

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