Is there any other command (or well known routine) which will preform
the function.
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...