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

HP49 Crunching Equations in SysRPL

2 views
Skip to first unread message

Jim Purdy

unread,
Dec 10, 1999, 3:00:00 AM12/10/99
to
A program I am "porting" from the HP48 that requires a little
modification.
During the process, I found the program uses the CRUNCH command to
evaluate an algebraic.
This command is present on the 49, but it runs VERY SLOW. I also
observed that the ->NUM
command on the 49 runs very slow too.

Is there any other command (or well known routine) which will preform
the function.


Jean-Yves Avenard

unread,
Dec 10, 1999, 3:00:00 AM12/10/99
to
Hello.

Yes CRUNCH is slower on the HP49 than on the HP48, because it has to convert
integers into real etc...

But there is a work-around that is using by the Plotter, the Numeric Table
etc...

If the aim is to perform a numeric evaluation of an equation several times
or in a critical loop, the OS provides an entry point called
SimplifyExpression that will (as its name says) simplify the expression and
will allow to replace some global variable with everything you want.
By simplification I mean:
-Replace every integers by reals
-Expand calls to user fonction. So if you want to simplify A(X)+1 and A
contains << -> X 'X+2' >> it will be simplified into X+3

SimplifyExpression (the address is # 2AAE0h) takes 3 arguments
3: Expression to simplify
2: { list of variables 1}
1: { List of variables 2 }

Example:
In the plotter, the independant variable is contained in the local variable
15.
So if you plot the expression 'SIN(X)' instead of changing the global
variable X for every value (which is really slow), we simply modify the
local variable 15
So the plotter for 'SIN(X) will call SimplifyExpression with the following
argument:
3: 'SIN(X)'
2: { ID X }
1: { 15GETLAM }

SimplifyExpression will return:
1: DOSYMB 15GETLAM xSIN ;

Then, in you main loop, we replace CRUNCH with a simple COMPEVAL that is
much faster

If you don't want some expression to be replaced by their value, let say in
SIN(X)+A you want A to stay unchanged, you will then call SimplifyExpression
with:
3: SIN(X)+A
2: { ID X ID A }
1: { 15GETLAM ID A }

SimplifyExpression will return:
1: DOSYMB 15GETLAM xSIN ID A x+ ;

By using SimplifyExpression and COMPEVAL, you can speed up the loop by
around 40% from the same HP48 code..
If you don't use SimplifyExpression and keep your HP48 code unchanged with
CRUNCH, it will be 2 to 3 times slower.

The main engine for evaluation should be:
( 1: Expression or program to evaluate )
::
DUPTYPESYMB? case :: COMPEVAL DUPTYPESYMB? NOT?SEMI CRUNCH ;
CRUNCH
;

Of course this way is faster only if you need to crunch an expression
several times...
If you want to do it only one time, then the old HP48 way using CRUNCH is
better.

Cheers
Jean-Yves


"Jim Purdy" <jpu...@home.com> wrote in message
news:3850E823...@home.com...

0 new messages