Plus42 algebraic expressions update
03-09-2021, 07:58 AM
Post: #101
 Werner Senior Member Posts: 696 Joined: Dec 2013
RE: Plus42 algebraic expressions update
Thank you, Thomas!

One of the reasons the 42S is my favourite is exactly this (I'm easily pleased): FACT accepts only integers, and it has a GAMMA function. They are different beasts. Some calculators accepted fractional input to save on a command name, I guess.

And yes, I do have a routine that would be broken if that behaviour would be changed ;-)

Cheers, Werner
03-09-2021, 11:36 AM
Post: #102
 johanw Member Posts: 184 Joined: Nov 2019
RE: Plus42 algebraic expressions update
(03-09-2021 03:43 AM)Thomas Okken Wrote:  I assume the reason why the HP-42S has separate N! and GAMMA functions
Oops, I forgot the 42s has a separate Gamma function. Then it does not matter much.
03-09-2021, 01:16 PM
Post: #103
 johanw Member Posts: 184 Joined: Nov 2019
RE: Plus42 algebraic expressions update
(03-09-2021 07:58 AM)Werner Wrote:  And yes, I do have a routine that would be broken if that behaviour would be changed ;-)
Out of curiosity, what would that be? The only thing I can imagine is some reliance on error handling.
03-09-2021, 02:27 PM
Post: #104
 Werner Senior Member Posts: 696 Joined: Dec 2013
RE: Plus42 algebraic expressions update
I use N! as a input check on small positive integers..

SF 25
N!
FC?C 25
GTO ERR
...

Cheers, Werner
03-09-2021, 04:23 PM
Post: #105
 johanw Member Posts: 184 Joined: Nov 2019
RE: Plus42 algebraic expressions update
(03-09-2021 02:27 PM)Werner Wrote:  I use N! as a input check on small positive integers..

SF 25
N!
FC?C 25
GTO ERR
...

Cheers, Werner
Oof, that's dirty! But indeed depending on an error condition, like I assumed.

But what's wrong with just testing if N < some number? Your test depends on the range of numbers the calculator supports, it will give a different result on a HP42s and a DM42 or Free42.
03-09-2021, 05:04 PM
Post: #106
 Werner Senior Member Posts: 696 Joined: Dec 2013
RE: Plus42 algebraic expressions update
It tests whether X is integer, positive and (relatively) small, all in one go ;-)
A similar thing would be

X<0?
GTO ERR
FP
X>0?
GTO ERR
X<> ST L
N
X<Y?
GTO ERR

Werner
03-11-2021, 04:00 AM (This post was last modified: 03-11-2021 04:27 AM by Thomas Okken.)
Post: #107
 Thomas Okken Senior Member Posts: 1,767 Joined: Feb 2014
RE: Plus42 algebraic expressions update
10:56 PM EST / 3:56 UTC -- New builds. Nothing very interesting yet: Fixed a crash in the matrix editor's GOTO, when the stack was empty (big stack mode only, obviously); fixed crash in DROPN in 4STK mode; fixed coordinate bounds check in AGRAPH that could cause nothing to get drawn when the object was 1 pixel from being entirely off-screen; created "adaptive" icons for Android 8 and later.

UPDATE 11:26 PM EST / 4:26 UTC -- Also restored full filesystem access in the file selection dialog for Android 10.
03-11-2021, 10:32 AM
Post: #108
 Thomas Okken Senior Member Posts: 1,767 Joined: Feb 2014
RE: Plus42 algebraic expressions update
(03-06-2021 04:38 PM)Vincent Weber Wrote:  Reading again this interesting discussion made me think of something: the 35S handles equations in programs not by pointing to the equation list using a name, but directly: you enter the equation in the program by pressing EQN, this puts the equation in the program as a single step, directly readable when reviewing the program. Quite convenient. A flag indicates whether this step should be treated as a mere comment (just text to be ignored) or as an actual equation to evaluate.

It looks like it would be useful to have an instruction for creating long strings directly on the stack, without using the ALPHA register and ASTO/XASTO. And that would allow putting equations right into a program as well.

It's not clear to me what the interaction of such an inline-long-string-treated-as-equation with the rest of the equation functionality should be, though. Could you give one or two examples how evaluating or solving in-line equations works in the 35S?
03-11-2021, 11:01 AM
Post: #109
 Vincent Weber Member Posts: 255 Joined: May 2015
RE: Plus42 algebraic expressions update
(03-11-2021 10:32 AM)Thomas Okken Wrote:
(03-06-2021 04:38 PM)Vincent Weber Wrote:  Reading again this interesting discussion made me think of something: the 35S handles equations in programs not by pointing to the equation list using a name, but directly: you enter the equation in the program by pressing EQN, this puts the equation in the program as a single step, directly readable when reviewing the program. Quite convenient. A flag indicates whether this step should be treated as a mere comment (just text to be ignored) or as an actual equation to evaluate.

It looks like it would be useful to have an instruction for creating long strings directly on the stack, without using the ALPHA register and ASTO/XASTO. And that would allow putting equations right into a program as well.

It's not clear to me what the interaction of such an inline-long-string-treated-as-equation with the rest of the equation functionality should be, though. Could you give one or two examples how evaluating or solving in-line equations works in the 35S?

Hi Thomas,

The general principle on the 35S is: while in a program, you press EQN, this gives you access to the equation editor as if you were in the equation list, except that a new step number is created and inserted on the left side (so you have less steps for your equation). When you hit enter, the step is validated, you see when navigating through the program the step number + whatever part of the equation can be show on the rest of the line. When on the step, pressing the left arrow put you in the equation editor again, so that you can review/edit.
When executing the program, depending on a flag (#11 I think), the step is either treated as a comment (i.e. ignored), or the equation is evaluated (L-R if an equal sign is present), and the result put on the stack.

I'm not sure whether or not you can SOLVE such a equation in program. I don't think so, since SOLVE on the 35S requires that FN= has been properly set to a label prior to solving. You can also solve an equation interactively while in the equation list, but not within the program editor (pressing SOLVE there, even while editing an equation step, just exits the editor and creates a new step starting with SOLVE).

Best for examples is this excellent article by Valentin Albillo, he makes heavy usage of equations in his program:

https://albillo.hpcalc.org/articles/HP%2...umbers.pdf

While you are on his site, you can also have a look as his free42's feature request document, which may keep you busy for the rest of your life

Finally, you can find HP's free 35S emulator for Windows here:

https://www.educalc.net/2336231.page

Hope this helps.

Cheers,

Vincent
03-12-2021, 02:02 AM
Post: #110
 Thomas Okken Senior Member Posts: 1,767 Joined: Feb 2014
RE: Plus42 algebraic expressions update
(03-11-2021 11:01 AM)Vincent Weber Wrote:  Hope this helps.

I'm sure it will. Thanks!
03-12-2021, 08:45 AM (This post was last modified: 03-13-2021 09:05 AM by Vincent Weber.)
Post: #111
 Vincent Weber Member Posts: 255 Joined: May 2015
RE: Plus42 algebraic expressions update
(03-06-2021 07:10 PM)BruceH Wrote:
(03-05-2021 12:37 AM)Vincent Weber Wrote:  Hi Thomas,
Cool !
Btw I think I found a non-disruptive way of entering one-step complex numbers, à la 35S, like I mentioned before.
While in number entry mode, there are two keys that are forbidden to type twice in a row: "." and "E". So on the second keypress, "." could be changed to "i" and "E" to "theta", thus allowing complex entry without altering 42S normal behaviour, nor changing the skin. This also could be used in equation mode, to solve complex values (and allowing complex equation variables) symbolically when possible, as discussed earlier.

What do you think ?

Cheers

On the HP32SII pressing 1..2 enters 1/2. What if we ever wanted to introduce a fraction mode? ;-)
I have been thinking about this again, and I think there is a simple way to allow both 35S-style complex entry and fraction mode: dedicate the "." key to fraction mode. Use only "E" for complex entry with the following mecanism: one press is normal "E". Two presses changes "E" to "i" or "theta", depending on the current RECT/POLAR mode (seems logical to have less keypresses for the current mode). Three presses toggles "i" and "theta", for the cases where you have to enter a complex number in the other form than the current mode.
Simple, non-disruptive of the 42S operations, and "." Is free for a potential (useless IMHO, but some may want it) fraction mode
03-14-2021, 07:40 AM (This post was last modified: 03-14-2021 07:44 AM by Vincent Weber.)
Post: #112
 Vincent Weber Member Posts: 255 Joined: May 2015
RE: Plus42 algebraic expressions update
(03-12-2021 02:02 AM)Thomas Okken Wrote:
(03-11-2021 11:01 AM)Vincent Weber Wrote:  Hope this helps.

I'm sure it will. Thanks!
Two corrections to my post regarding the 35S:

1) The 35S uses flag 10, not 11, to toggle the treatment of equations in programs;

2) The 35S does not only use equations as comments as I said, but actually displays the text of equations when flag 10 is set.

IMHO in Plus42 you should actually keep equations as comments rather than display them when flag <whatever, does not have to be 10: actually why not making it a system flag in the MODE menu> is set. The 42 already has the alpha register to display text, which the 35S doesn't have, so this would be redundant and confusing (when to use the alpha register and when to use an equation !).

Cheers,

Vincent
09-08-2021, 07:39 AM
Post: #113
 amalahama Junior Member Posts: 13 Joined: Jan 2021
RE: Plus42 algebraic expressions update
Hi Thomas,

Straight question, do you plan to port plus42 to DM42 calculators?

Thanks
09-08-2021, 01:18 PM
Post: #114
 Thomas Okken Senior Member Posts: 1,767 Joined: Feb 2014
RE: Plus42 algebraic expressions update
No.

But, bear in mind that I didn't port Free42 to the DM42, either. Once Plus42 is ready, maybe SwissMicros will port it to the DM42, or maybe someone else will do it, that's all possible. I just won't do it myself.
09-09-2021, 01:54 PM
Post: #115
 Thomas Okken Senior Member Posts: 1,767 Joined: Feb 2014
RE: Plus42 algebraic expressions update
Speaking of "when Plus42 is ready," I should probably say something about that, since that project has been at a standstill for the better part of a year now, while I had originally planned for it to be finished by now.

In a nutshell, a lot of things happened, including but not limited to COVID-19. I have decided to finally move back to the Netherlands, after more than 20 years in the United States, and at the moment, preparations for the move are keeping me busy.

After all the dust has settled, I am looking forward to resuming work on Plus42. I think it will be pretty neat and I can't wait to finish it and get it out there. Maybe it will get done before the end of the year, but certainly not much later than that.
01-25-2022, 11:16 AM
Post: #116
 OlidaBel Member Posts: 60 Joined: Mar 2021
RE: Plus42 algebraic expressions update
(09-09-2021 01:54 PM)Thomas Okken Wrote:  Speaking of "when Plus42 is ready," I should probably say something about that, since that project has been at a standstill for the better part of a year now, while I had originally planned for it to be finished by now.

In a nutshell, a lot of things happened, including but not limited to COVID-19. I have decided to finally move back to the Netherlands, after more than 20 years in the United States, and at the moment, preparations for the move are keeping me busy.

After all the dust has settled, I am looking forward to resuming work on Plus42. I think it will be pretty neat and I can't wait to finish it and get it out there. Maybe it will get done before the end of the year, but certainly not much later than that.
Welkom terug in NL dus ;-)
Thomas, is there somewhere some general introduction text for this project ? what is it, what is the goal, maybe some screenshots (you mentionned HP-27S skin somewhere, an algebric calculator !) ?

What is the role of this other simulator compared to the Free42/DM42 ?

---
HP 48GX, Prime G2, 50G. A long time ago : 11C, 15C, 28C, 28S. SwissMicros DM42, DM15L
01-25-2022, 02:39 PM
Post: #117
 Thomas Okken Senior Member Posts: 1,767 Joined: Feb 2014
RE: Plus42 algebraic expressions update
This is probably the best place to start at the moment, until I write some proper documentation and put it on my web site: