Post Reply 
Plus42 Equations, Preview Release
11-20-2021, 12:43 AM (This post was last modified: 04-03-2022 02:05 PM by Thomas Okken.)
Post: #1
Plus42 Equations, Preview Release
I just posted an update to Plus42 that includes full equation support.

(Latest Documentation: see here.)

The equation mode can be reached through the white [=] button in the SOLVER, ∫f(x), and PGMMENU menus. Equation objects can created in the equation editor, or by placing a string in the X register and converting it to an equation using the PARSE function, and they can then be passed to PGMSLV, PGMINT, VARMENU, and EVAL.

The CALC option in the equation editor performs PGMSLV if the editor was entered via the SOLVER menu, PGMINT if it was entered via the ∫f(x) menu, and it places the equation in both ALPHA and X and starts program execution if it was entered via PGMMENU.

When the solver is used with an equation, it supports direct solutions, using the same kind of algorithm, and the same restrictions, as the solver in the HP-17B and its ilk, and otherwise, it falls back on the familiar numerical solver.

In equations, you can use the full set of functions listed in Martin Hepperle's document "About The Solver in the HP Pocket Calculators," except for the financial functions.

There are a couple of additions to allow equations to call user programs and other equations: XEQ(NAME:X:Y:Z) calls LBL "NAME", assigning the parameters to the program's MVAR variables, if it has them, and pushing them on the stack otherwise; and NAME(X:Y:Z) calls an equation declared with a name and parameter list, like TRIANG(X):X*(X+1)/2; NAME can be anything that isn't the name of a built-in function.

In addition to the calculator's × and ÷ symbols for multiplication and division, the parser also accepts * and /, and in addition to the array access function ITEM(A:B), it also accepts the notation A[B]. For compatibility with the HP calculators, these features may be turned off, so the * / [ ] characters can be used in names; this is controlled using the STD/COMP setting in the MODES menu. The compatibility setting is applied when an equation is parsed and then stays with it for its lifetime, even if the system STD/COMP setting is changed later. When viewed on the stack, Plus42-style equations are displayed with straight single quote characters, while HP-compatible equations are displayed with backquote delimiters.

One potential compatibility issue that won't be easy to fix is that variable names must be no more than 7 characters long, instead of up to 10 characters on the original calculators. This is because Plus42 translates the equations to user code for execution, and variable access gets translated to HP-42S RCL "NAME" instructions.

From a user interface perspective, all this is still a bit rough around the edges; I'll add more functions in menus, and do a better job of hiding the user code that is generated by the parser and the direct solver. Some enhancements to the equation language are also planned, like access to the RPN stack, a generalized loop construct, and support for array indexing in the first argument of L().

Note that I decided to abandon compatibility with Free42 state files; I'm making a fresh start with the state file format, starting with this preview release. State files will be backward compatible going forward, but continuing to support compatibility all the way back to Free42 1.0 was becoming a burden, with all the changes that are happening under the hood.

Anyway, enjoy! I hope you like this and find it useful, and I'm looking forward to hearing what you think.

Here's the download link once more:
https://thomasokken.com/plus42/download/

Here's the previous thread on this topic:
https://www.hpmuseum.org/forum/thread-16372.html
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Plus42 Equations, Preview Release - Thomas Okken - 11-20-2021 12:43 AM



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