[comp.sys.handhelds] 48sx ROOT question

tim@nijinsky.ipac.caltech.edu (Tim Conrow) (06/25/91)

Hi,
  I KNOW this has been brought up before, but it wasn't of interest then, 
it is now. To avoid boring other csh readers, email will be just fine,
unless you think your reply is of broad interest.
 
  I'd like to use the ROOT function in a program in a way that avoids a 
few problems.

1) Does ROOT always need an algebraic to solve? Does this slow it down?
   I assume programs are faster, n`est pas?
2) Another speed issue: Can ROOT be made to work for less than 12 digit
   precision? Full precision takes too long and is unnecessary for my
   purposes. I tried putting a RND(equation,6) call in my algebraic, but
   it got no faster.
3) This is a small thing, but it bothers me: ROOT requires you to name 
   a  variable to solve for, but I can't make it work naming a local
   variable in a program. Does it always need an global name? This is a
   pain because it means the variable being solved for will be created
   in my current directory, which means I have to do the following
   kludge if all I want is an answer on the stack:
<<  ...   'algrbaic' 'uniqueX' guess ROOT 'unqiueX' PURGE ... >>
   Not horrible, I suppose, but inelegant.

  An ideal solution to all these points would be a mode where a program
is given as the equation, requiring no variable name to solve for, just
using the stack. Like 
<< ... <<program>> guess ROOT ... >>
Does a mode like this exist?
  I know the solver can be used with a program as the equation, but the 
manual is silent on how to do this with ROOT in a program.

  What's the deal? What have I missed? Does the HP Programmer's Manual
deal with this? Are there any publications that do? A pointer to one of
them would be a wonderful response, if you wish to avoid sending a
lengthy explanation.

Thanks all,
-- Tim
tim@ipac.caltech.edu

edp@jareth.enet.dec.com (Eric Postpischil (Always mount a scratch monkey.)) (06/25/91)

In article <1991Jun24.203727.3043@nntp-server.caltech.edu>,
tim@nijinsky.ipac.caltech.edu (Tim Conrow) writes:

>1) Does ROOT always need an algebraic to solve? Does this slow it down?
>   I assume programs are faster, n`est pas?

Valid arguments for ROOT are either a program or symbolic in level 3,
the global name to solve for in level 2, and a guess or list of guesses
in level 1.  So, yes, you can give ROOT a program.  The program should
take no arguments from the stack and return exactly one result to the
stack.

I would not expect this to be faster, unless algebraic syntax is forcing
you to use some work-arounds to get at non-algebraic commands (like
UTPN).  Barring that, programs are not any faster, because algebraics
and programs are stored and evaluated very much the same way.

>2) Another speed issue: Can ROOT be made to work for less than 12 digit
>   precision? Full precision takes too long and is unnecessary for my
>   purposes. I tried putting a RND(equation,6) call in my algebraic, but
>   it got no faster.

No.  Hewlett-Packard probably decided this was not necessary because the
ROOT algorithm is very good for many functions and usually converges
quickly.  You might be able to play with the function to help ROOT
converge more quickly -- perhaps by exaggerating return values or by
transforming the domain in the region of asymptotic behavior (e.g., if
the function is nearly flat over a long region, transform the domain to
make that region smaller).

> Does the HP Programmer's Manual deal with this?]

The Programmer's Reference Manual shows that programs are acceptable as
input, but it does not answer your other questions directly.  (It does
show only a global name acceptable as the level 2 input.)



				-- edp (Eric Postpischil)
				"Always mount a scratch monkey."
				edp@jareth.enet.dec.com