The Museum of HP Calculators

HP Forum Archive 08

[ Return to Index | Top of Index ]

Re: Polar to Rectangular etc. on the 48 Series
Message #1 Posted by James M. Prange on 19 July 2002, 5:35 a.m.

Press the MTH key, then the VECTR menu key, then the NXT key to get to the RECT, CYLIN, and SPHER coordinate system mode setting keys. Press NXT again to get back to the first page of the menu, where you'll find the V\-> command, which will return the components of a complex number or vector as real numbers appropriate to whichever coordinate system and angular modes are in effect. You could also use OBJ\-> to take these objects apart. On the same menu page you have the \->V2 and \->V3 commands for making vectors from real numbers. Note that RECT, CYLIN, and SPHERE are also available as commands.

MTH NXT and menu key CMPL gives you a page and a half of commands for working with complex numbers.

Play around with these commands a bit, and I think that you'll find the 48 very easy to use, even though a complex number is a different object type, not just two numbers.

SYSEVAL does have some dangers. The only argument checking that it does is to make sure that there's a user binary integer in level 1. Then it goes to whatever address you gave it and executes whatever happens to be there. If you give it the wrong address, or give it the right address but don't have whatever arguments that that routine requires on the stack, then you may very well get a warmstart or find yourself at the "Try To Recover Memory?" screen. So if you use it in a program, make sure that the program checks for any needed arguments before doing the SYSEVAL, and double check the binary integer value (including the base) before you run it.

Similar precautions apply to the LIBEVAL command, except that it will error out if the library function doesn't exist.

Make sure that you always have a recent backup.

And yes, I'm sure that there must at least be addresses for displaying complex number and vectors in the different coordinate system and angular units, and for taking complex numbers and vectors apart and putting them back together again, but why do easy things the hard way?

If you want to learn more about what "internal" routines are available, then visit www.hpcalc.org and see the wealth of information about SysRPL programming available there.

Regarding LASTX, I'm not too sure what you're asking for; do you mean that you want to put only whatever was previously on level 1 before the most recent command was executed back on the stack? The following program should restore whatever was the level 1 argument for the last command that took any arguments. Note that it doesn't restore what was on level 1 before commands that don't take any arguments, like CLEAR, DEPTH, STD, MEM, and so on. If flag -55 is set, then it errors out. If flag -55 is clear but the last argument buffer is empty, then it puts the number 0 in the last argument buffer.

\<<
  DEPTH \-> d
  \<< LASTARG DEPTH d -
    IF
      DUP
    THEN
      DUP2 2 + ROLLD DROPN DUP
    END
    DROP
  \>>
\>>
Checksum: # 558Fh
Bytes: 69
Is that what you're looking for?

Regards,
James


[ Return to Index | Top of Index ]

Go back to the main exhibit hall