Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

User Equation Library in User-RPL

65 views
Skip to first unread message

John H Meyers

unread,
Mar 8, 1998, 3:00:00 AM3/8/98
to

%%HP: T(3); @ Multi-level User Equation Library (HP48G/GX) by JHM

@ Has features resembling the built-in Equation Library,
@ but allows you to supply the equations, etc.

@ The entire equation library presented here is a directory;
@ within this directory, you may create any desired subdirectories,
@ perhaps each pertaining to a separate topic, as in the built-in EQ LIB.

@ You may even create nested subdirectories, if you wish, or you may elect
@ to have no subdirectories (storing all equations in the main directory).

@ You may use your own arbitrary names for directories and equations;
@ names up to 14-15 characters will appear in full in the "choose" boxes,
@ and may be mixed upper/lower case letters if you wish.

@ The correct solver is automatically selected for each equation or set.
@ You may enter values with units, but there are no pre-assigned units.

@ A "custom" menu (invoked via the [CST] key) is provided,
@ resembling the built-in menu:
@
@ [Solv] Re-start the solver, using the current equation (or set).
@ [EQ] The current 'EQ' variable, if any.
@ [Vars] Display current equation's variable info, if provided.
@ [Pic ] Display current equation's picture, if any.
@ [Menu] List current subdirectories and/or equations ("choose" box).
@ [Up^] Up one level (and automatically display its menu).
@ [Purg] Purge all extraneous variables created from solving equations
@ (purges only numeric and unit-valued variables, plus EQ & Mpar)
@ [CST] Invoke any custom menu found in the HOME directory.

@ Store this complete directory in HOME, perhaps named 'EQLIB'

@ If you don't want some of the optional features, e.g. Vars and Pic,
@ you can delete their programs and custom menu entries, to save memory.

DIR @ Directory: name <object> name <object> ...

Set1 @ Sample sub-directory of equations:
DIR
@ Deeper sub-directories are permitted, if desired.
Eq1 'X=1' @ This will use the standard solver
Eq2 { 'Y=2' 'Z=3' } @ This will use the Multiple-Equation solver
Eq3 \<< W 4 - \>> @ Programs may be used as equations
Stop { } @ Stops menu listing when encountered
Eq2VARS { "Y: is Y" "Z: is Z" } @ Optional variables list for Eq2
@ An optional picture may also be stored in Eq2PICT, etc.
END

Set2 DIR END @ Second sub-directory, etc.

@ If you use a variable hider, then hide the remaining variables:

Stop { } @ Stops menu listing in this directory (even without hider).

Solv @ [Re]start the solver, using the most recent equation (or set):
\<< RCEQ DROP IFERR MINIT THEN 30 MENU ELSE MSOLVR END \>>

Vars @ Display current equation's variable info, if a list is provided
@ (info list for equation 'xxx' must be stored in 'xxxVARS')
\<< RCEQ DROP 'EQ' RCL DUP "" + "'" ROT + "VARS" + OBJ\->
DUP VTYPE 5 == @ Is it a list?
{ RCL 1 CHOOSE { DROP } IFT } @ Display the list
{ DROP2 "No Info" DOERR } IFTE \>> @ No list provided

Pic @ Display current equation's picture, if any
@ (picture for equation 'xxx' must be stored in 'xxxPICT')
\<< RCEQ DROP "'" 'EQ' RCL + PICT + OBJ\->
DUP VTYPE 11 == @ Is it a grob?
{ RCL \->LCD 3 FREEZE } @ Or: { RCL PICT STO { } PVIEW }
{ DROP "No Pic" DOERR } IFTE \>> @ No picture provided

Menu @ Catalog of directories and/or equations to choose from:
\<< PATH DUP SIZE GET "" + { 5 8 9 15 } TVARS
'Stop' DUP2 + SWAP POS 1 - 1 SWAP SUB @ Stop at 'Stop'
IF DUP SIZE THEN 1 CHOOSE @ Choose a directory or equation
{ DUP VTYPE 15 == { EVAL Menu } { STEQ Solv } IFTE } IFT
ELSE DROP2 "No Items" DOERR END \>>

Purg @ Purge all extraneous variables created from solving equations
@ (purges only numeric and unit-valued variables, plus EQ & Mpar)
\<< { 0 13 } TVARS { EQ Mpar } + PURGE \>>

CST @ Indirect pointer, protects CSTM from accidental MENU command.
CSTM

CSTM @ Custom menu for User Equation Library (Use it!)

{ @ Protect programs from being stored into:

{ Solv \<< Solv \>> } @ Solver

EQ @ The current 'EQ' variable, if any (allows RCL/STO)

{ Vars \<< Vars \>> } @ Optional variables list

{ Pic \<< Pic \>> } @ Optional picture

{ Menu \<< Menu \>> } @ Choose

{ \|^ \<< PATH SIZE 2 > { UPDIR } IFT Menu \>> } @ Up one level
@ Adjust the constant if this directory is at a lower level
@ (to prevent going above the main directory level).

@ ---- Next page (six labels) of CST menu ----

{ Purg \<< Purg 1 MENU \>> } @ Purge extraneous variables

@ An optional feature, used by the author:
{ CST \<< { HOME CSTM } RCL TMENU \>> } @ Display CST[M] from HOME

} @ End of custom menu CSTM

END @ Directory ends.

John H Meyers

unread,
Mar 11, 1998, 3:00:00 AM3/11/98
to

Here again is a User-RPL User Equation Library.

Creeping featurism has set in -- at the expense of about 90 more bytes,
plus a few more slight pauses for GC's, you can also have
the menus ("choose" boxes) remember where you were,
just as does the built-in Equation Library.

The entire library system is reproduced again below; the programs
and custom menu will take anywhere from about 500-600 bytes for a
"stripped" version to about 900 bytes for the whole shebang; you
decide how much you want or need, and customize it for yourself.

Note that 'Menu' stores into EQ only the name of the current equation
(or set), not a copy of the current equation; you should always store
any new equation in a new named variable, not directly into EQ itself.

Pressing the EQN menu key will recall the current equation(s),
if any; the variable EQ is no longer directly accessible in the menu
(you can now press 'Menu' to see which equation is currently selected).

A "variables list" (a list of strings) is your optional explanation
of what your variables mean, as in the built-in library; however,
there are no default units associated with variables in our version.

-----------------------------------------------------------------

%%HP: T(3); @ Multi-level User Equation Library (HP48G/GX) by JHM

@ Has features resembling the built-in Equation Library,
@ but allows you to supply the equations, etc.

@ This version "remembers" the last menu selection, and
@ highlights it in each menu ('Menu' and 'CSTM' were modified).

@ (added optional 'name' argument for initial selection)
\<< DEPTH { DUP TYPE 6 \=/ } 1 IFTE @ Current DIR or EQ name
{ IFERR RCEQ DROP ::EQ RCL THEN 0 END } IFT @ (if any)
PATH DUP SIZE GET "" + { 5 8 9 15 } TVARS @ Added lines above


'Stop' DUP2 + SWAP POS 1 - 1 SWAP SUB @ Stop at 'Stop'

IF DUP SIZE THEN ROT OVER SWAP POS 1 MAX CHOOSE @ Was: THEN 1 CHOOSE


{ DUP VTYPE 15 == { EVAL Menu } { STEQ Solv } IFTE } IFT

ELSE DROP2 DROP "No Items" DOERR END \>> @ Added DROP

Purg @ Purge all extraneous variables created from solving equations
@ (purges only numeric and unit-valued variables, plus EQ & Mpar)
\<< { 0 13 } TVARS { EQ Mpar } + PURGE \>>

CST @ Indirect pointer, protects CSTM from accidental MENU command.
CSTM

CSTM @ Custom menu for User Equation Library (Use it!)

{ @ Protect programs from being stored into:

{ Solv \<< Solv \>> } @ Solver

{ EQN RCEQ } @ Recall current equation (modified)

{ Vars \<< Vars \>> } @ Optional variables list

{ Pic \<< Pic \>> } @ Optional picture

{ Menu \<< Menu \>> } @ Choose directory and/or equation

@ Up one level (inserted PATH DUP SIZE GET for 'Menu' argument)
{ \|^ \<< PATH SIZE 2 > { PATH DUP SIZE GET UPDIR } IFT Menu \>> }

0 new messages