The following warnings occurred:
Warning [2] Undefined array key 105876 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 105881 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 105887 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 105904 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 105909 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 105910 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 105914 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 105928 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 105932 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 105935 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 105940 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 105947 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 105949 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $thread - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $fid - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 105881 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 105940 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 105949 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 105910 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 105947 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $theme - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $theme - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $lang - Line: 5 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 5 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Attempt to read property "messages_in_thread" on null - Line: 5 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 5 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks





p->r



#5

Hello!
How do I convert polar coordinates to rectangular with my hp 49g+?
Please help me!


#6

Hi;

the HP49G+ (along with the HP48 series and HP50) allows many coordinate/complex number representations, so you can choose one or another and the number itself is kept the same as you enter. Given that you have either the rectangular

(5.00,5.00)
or polar
(7.07 <45.00)
in stack level 1, you can use:

ARG to get 45.00 (argument, angle);

ABS to get 7.07 (absolute value);

REAL to get 5.00 (the real part, X-value);

and another function I do not recal to get 5.00, the complex part (could it be COMPLEX? CMPLX? Cannot recall, sorry...)

RPN/Algebraic-based models actually convert from one representation to another, but the RPL models keep consistent representation, while the rectangular form is internally stored.

You can find other information here and probably here. Although these links point to HP50G documents, its operation with complex/2D vectors is mostly the same as in the HP49G+.

Hope this helps.

Cheers.

Luiz (Brazil)


Edited: 12 Jan 2007, 1:27 p.m.

#7

I have a 50G, but it should be similar to a 49G+.

First, go to MODE and check the following settings:

- Set "Angle Measure" to degrees or radians. Let's use degrees.

- Set "Number Format" to an appropriate value. Let's use Fix 2.

- Set "Coord System" to rectangular, because you are converting from polar to rectangular.

You should see DEG XYZ in the upper left corner of the display, which indicates degrees and rectangular coordinates.

Now enter your point, in polar notation, onto the stack. Suppose the point is (7.07, 45 degrees). You enter:

[left-shift] ( )

7.07

ALPHA [right-shift] 6

45

The ALPHA-[right-shift]-6 combination generates the angle symbol, which tells the calculator that these are polar coordinates.

Now hit ENTER. The calculator will recognize that these are polar coordinates, and will automatically convert them to rectangular format (because you specified this format in MODE). You will see (5.00,5.00) on level 1 of the stack.

If you want to convert back to polar coordinates, go to MODE and change the "Coord System" setting to Polar. The point will automatically change back to (7.07, angle 45.00)


Edited: 12 Jan 2007, 3:08 p.m.


#8

Not nearly as simple, quick and elegant as the P->R key on the old RPN models, is it? I'd bet a wooden nickle a person could bang out the rectangular coordinates manually faster than having to do it that way. Or, just write a short program that takes the numbers in the bottom two stack levels as the polar argument and converts them: (M sin(theta) for the imaginary, and M cos(theta) for the real coordinate. Granted this wouldn't integrate with the vast complex number functionality built into the calculator, but it will let you easily throw in some polar coordinates in (as pure numbers!) and view the rectangular outcome...just like in the good ole' days!

Best regards, Hal


#9

Hi, Hal!

Quote:
Not nearly as simple, quick and elegant as the P->R key on the old RPN models, is it?

Hmm, that is old! I don't own any 1970's LED models between the HP-35 and HP-34C; neither those nor any subsequent RPN-based model had a polar-to-rectangular "P->R" function denoted as such. However, the HP-65 and HP-67/97 did have "P->R" and "R->P".

The HP-42S had "->REC"; the HP-32S/SII had "theta,r->y,x".

Most earlier models had "->R"; on the HP-15C this worked on two real values or on one complex value.

The HP-28C/S also had "P->R" and "R->P", which worked only on complex values. Its main shortcoming was that it could not compute in polar-coordinate complex values or display one as such (with angle symbol).

Here's an annoying flaw of the HP-42S: Convert a complex-valued number from one format to the other using "->POL" or "->REC". The components will be converted correctly, but the representation will be unchanged. Example:

 5.00 i12.00  ->POL     yields  
13.00 i67.38 (deg)

Personally, I dislike the parenthesized ordered-pair representation of complex numbers on the RPL-based models. It could be many things in the notation of mathematics:

  • A complex number a + ib
  • A pair of 2-variable statistical data (x, y)
  • A point on a function plot (t, f(t))
  • An open numerical interval (a, b) ["between a and b but not including either"]

The complex-value representation of the HP-42S is ideal, I'd say.

None of the HP calc's got complex numbers completely right, though. I had some suggestions a while ago:

User-friendly complex numbers

-- KS


Edited: 13 Jan 2007, 6:25 p.m. after one or more responses were posted


#10

My favorite R->P, P->R function implementation on the old HP calculators is on the HP-46. When you have the printer turned on it prints both the X and Y registers after performing the conversion. It's sort of startling at first since this is the only function that works that way and you expect to see/hear the printer just output one number not two.

Because R->P and P->R are non-standard "functions", it's quite interesting to see how different calculator manufactures decided to implement this. The RPN stack makes it seem like there's an obvious way to do this, but there is no obvious way on non-RPN calculators, for example:

The Compucorp 320/322/324 works like this:
x, R->P, y, = (see theta), 2nd function (see r)

While the Compucorp 325/326 works like this:
x, R->P, y, = (see theta), = (see r)

The Monroe 1920:
x, R->P, y, = (see theta), RCL 8 (see r)

The TI-58/59:
x, X<->T, y, R->P (see theta), X<->T (see r)

The Commodore 9190:
x, X<->Y, y, R->P (see r), X<->Y (see theta)

The Sharp El-5001:
x, A, y, B, R->P, A (see r), B (see theta)

This last example makes the EL-5001 look bad, actually it's the only one of the bunch that appears to have some serious thought behind dealing with multi-factor "functions". It implements several of them using it's barrel function selector knob and dedicated function keys. But most scientific calculators from the pre-LCD era don't even try to implement the R->P, P->R functions.

-Katie


#11

Hi, Katie --

Quote:
Because R->P and P->R are non-standard "functions", it's quite interesting to see how different calculator manufacturers decided to implement this.

By strict mathematical definition, R->P and P->R each are two functions in one command:

r = sqrt(x2 + y2)
theta = atan2(y, x)

x = r * cos(theta)
y = r * sin(theta)

It is indeed astounding how complicated and obfuscated these two commands are, on modern algebraic EOS calculators. On some of them in my collection, I couldn't even deduce how the commands worked. (This is unimportant, because I don't use them in practice, and didn't pay very much for them...)

The HP-30S seems to have borrowed from TI-82. There are commands called R->Pr(), R->Ptheta(), P->Rx(), and P->Ry() under menus, in which the user must first select the command, then input both coordinate values inside the parentheses, in order to receive only one of the converted values.

The older AOS models, such as the HP-20S and Casio fx-3600P (from 1981) are more straightforward, because they have a SWAP (x<->y)function to see both results. It is easy to convert back and forth on the HP-20S without re-entering or re-arranging data, unlike with practically every other non-RPN calculator.

Then, of course, there is the early HP-33S, which gave wrong answers(!), as discussed previously:

http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv014.cgi?read=61086#61086

-- KS

Edited: 13 Jan 2007, 6:13 p.m.

#12

Okay, for something like the 28 series commands, in UserRPL source
code:

%%HP: T(3);     @ ASCII transfer header.
@ 2 dimensional P\->R program.
@ Arguments: 2 reals representing r and theta.
@ Returns: 2 reals representing x and y.
\<< @ Begin program.
RCLF @ Get current flags.
ROT ROT @ Move flags list to level 3.
@ On 49 series, UNROT may be used
@ instead of ROT ROT.
CYLIN @ Force cylindrical display mode.
@ SPHERE would work as well here.
\->V2 @ Combine into vector or complex.
RECT @ Force rectangular display mode.
V\-> @ Decompose into reals.
ROT @ Move flags list back to level 1.
STOF @ Restore original flags.
\>>
%%HP: T(3);     @ ASCII transfer header.
@ 2 dimensional R\->P program.
@ Arguments: 2 reals representing x and y.
@ Returns: 2 reals representing r and theta.
\<< @ Begin program.
RCLF @ Get current flags.
ROT ROT @ Move flags list to level 3.
@ On 49 series, UNROT may be used
@ instead of ROT ROT.
RECT @ Force rectangular display mode.
\->V2 @ Combine into vector or complex.
CYLIN @ Force cylindrical display mode.
@ SPHERE would work as well here.
V\-> @ Decompose into reals.
ROT @ Move flags list back to level 1.
STOF @ Restore original flags.
\>>
%%HP: T(3);     @ ASCII transfer header.
@ 3 dimensional Cylindrical\->Rectangular program.
@ Arguments: 3 reals representing r, theta, and z.
@ Returns: 3 reals representing x, y, and z.
\<< @ Begin program.
RCLF @ Get current flags.
4 ROLLD @ Move flags list to level 4.
CYLIN @ Force cylindrical display mode.
\->V3 @ Combine into vector.
RECT @ Force rectangular display mode.
V\-> @ Decompose into reals.
4 ROLL @ Move flags list back to level 1.
STOF @ Restore original flags.
\>>
%%HP: T(3);     @ ASCII transfer header.
@ 3 dimensional Rectangular\->Cylindrical program.
@ Arguments: 3 reals representing x, y, and z.
@ Returns: 3 reals representing r, theta, and z.
\<< @ Begin program.
RCLF @ Get current flags.
4 ROLLD @ Move flags list to level 4.
RECT @ Force rectangular display mode.
\->V3 @ Combine into vector.
CYLIN @ Force cylindrical display mode.
V\-> @ Decompose into reals.
4 ROLL @ Move flags list back to level 1.
STOF @ Restore original flags.
\>>
%%HP: T(3);     @ ASCII transfer header.
@ 3 dimensional Spherical\->Rectangular program.
@ Arguments: 3 reals representing rho, phi, and theta.
@ Returns: 3 reals representing x, y, and z.
\<< @ Begin program.
RCLF @ Get current flags.
4 ROLLD @ Move flags list to level 4.
SPHERE @ Force spherical display mode.
\->V3 @ Combine into vector.
RECT @ Force rectangular display mode.
V\-> @ Decompose into reals.
4 ROLL @ Move flags list back to level 1.
STOF @ Restore original flags.
\>>
%%HP: T(3);     @ ASCII transfer header.
@ 3 dimensional Rectangular\->Spherical program.
@ Arguments: 3 reals representing x, y, and z.
@ Returns: 3 reals representing rho, phi, and theta.
\<< @ Begin program.
RCLF @ Get current flags.
4 ROLLD @ Move flags list to level 4.
RECT @ Force rectangular display mode.
\->V3 @ Combine into vector.
SPHERE @ Force spherical display mode.
V\-> @ Decompose into reals.
4 ROLL @ Move flags list back to level 1.
STOF @ Restore original flags.
\>>
%%HP: T(3);     @ ASCII transfer header.
@ 3 dimensional Cylindrical\->Spherical program.
@ Arguments: 3 reals representing r, theta, and z.
@ Returns: 3 reals representing rho, phi, and theta.
\<< @ Begin program.
RCLF @ Get current flags.
4 ROLLD @ Move flags list to level 4.
CYLIN @ Force cylindrical display mode.
\->V3 @ Combine into vector.
SPHERE @ Force spherical display mode.
V\-> @ Decompose into reals.
4 ROLL @ Move flags list back to level 1.
STOF @ Restore original flags.
\>>
%%HP: T(3);     @ ASCII transfer header.
@ 3 dimensional Spherical\->Cylindrical program.
@ Arguments: 3 reals representing rho, phi, and theta.
@ Returns: 3 reals representing r, theta, and z.
\<< @ Begin program.
RCLF @ Get current flags.
4 ROLLD @ Move flags list to level 4.
SPHERE @ Force spherical display mode.
\->V3 @ Combine into vector.
CYLIN @ Force cylindrical display mode.
V\-> @ Decompose into reals.
4 ROLL @ Move flags list back to level 1.
STOF @ Restore original flags.
\>>
Regards
James
#13

I just know 48 series can use"vector" to do it

5 (distance)
enter
53.13010235 (angle in degree mode)

VECTR
NXT
RECT

(3 , 4)

#14

The other responders have explained the use of the display and entry modes of the 49g+. That may well have been what you were after, but just in case what you really want to do is mimic the way classic calculators did polar to rectangular and rectangular to polar conversion, I’ll offer the following.

If you want to do it "the old fashioned way", using level 1 and level 2 of the stack to hold the x and y components, respectively, of a number in rectangular form, or the magnitude and angle, respectively, of a number in polar form, and you want functions to convert between these two representations, the 49g+ does not have built-in, named RPL functions to do so. You have to write your own programs. To do these functions, I initially wrote programs that used trig functions and such to do the work. Then somewhere along the line, I learned that there are SYSEVAL addresses that would perform these functions. It sort of bugged me that the functions were actually “in the calculator” but were not made easily accessible, so even thought there was nothing wrong with my original programs, I wrote new versions using the SYSEVAL addresses. These are as follows:

Polar to Rectangular:
<< SWAP # 200358d SYSEVAL SWAP >>

Rectangular to Polar:
<< SWAP # 200313d SYSEVAL SWAP >>

I stored the first in a variable named ‘P->R’ and the second in a variable named ‘R->P’, put them in a custom menu, and have keyboard accessible functions just like my good ‘ol HP-45.

Oh yeah, since SYSEVAL calls can cause your calculator to crash if you type in the wrong address, you might want to back-up your calculator before you try them for the first time, and use at your own risk. Also, these SYSEVAL addresses will not work on the 48G calculators.


Edited: 13 Jan 2007, 5:49 p.m. after one or more responses were posted


#15

Hi, Jeff --

Quote:
Oh yeah, since SYSEVAL calls can cause your calculator to crash if you type in the wrong address, you might want to back-up your calculator before you try them for the first time, and use at your own risk.

I tried your "R->P" on HP-48G, and it locked up. I guess the original 48's and the later models don't have the same addresses.

How about the HP-49G? The program didn't seem to work correctly, although it did run...

-- KS


#16

Karl,

Sorry, I should have stated that those SYSEVAL address numbers are for the 49g+/50g calculators only. (I'll go edit my post to state this.) I do have versions that work on the 48G series, but my 48 is at work right now and I am not. I'll post those on Monday. Regarding the 49g, I do not have one, so I cannot test. If you had not reported that it did not work I would have thought that it would work. Maybe James M. Prange can shed some light.

Regards,

Jeff


#17

Actually, I rather prefer the way the 48/49 series handles this.
Complex numbers and vectors are always stored (as single objects)
in rectangular coordinates. How they're displayed (or decompiled
for editing or transfer) depends on the coordinate display mode,
which can be selected by the RECT, CYLIN, and SPHERE commands, and
of course on the angular display mode, which can be set by the
DEG, RAD, and GRAD commands.

You could also change the display modes using the system flags:

Flag -15   Set: Spherical (if flag -16 set)
Flag -15 Clear: Cylindrical (if flag -16 set)

Flag -16 Set: Cylindrical or spherical
Flag -16 Clear: Rectangular

Flag -17 Set: Radians
Flag -17 Clear: Degrees or Grads

Flag -18 Set: Grads (if flag -17 clear)
Flag -18 Clear: Degrees (if flag -17 clear)

To decompose to separate real numbers in rectangular coordinates,
you can use the OBJ\-> command, or to decompose to real numbers in
the current angular and coordinate display mode, use the V\->
command. To combine 2 (or 3) reals into a vector, use the \->V2
(or \->V3) command.

If flag -19 is set, then \->V2 makes a complex number, and if flag
-19 is clear, then \->V2 makes a vector.

You can also use the ARRY\-> and \->ARRY commands to convert
between vectors and reals, or the C\->R and R\->C commands to
convert between complex and real numbers.

The RE command give you the real part of a complex number, and the
IM command gives you the imaginary part of a complex number. ARG
gives you the polar angle of a complex number.

ABS gives you the "length" of a complex or array, that is, the
square root of the sum of the squares of its (rectangular)
components.

If you want the compiler to recognize that a real represents an
angular component of a vector, then prefix it with the "angle
symbol", invoked by ALPHA RightShift 6 on the 49 series, or
RightShift SPC on the 48 series. Note that converting it from
polar to rectangular coordinates for internal representation may
introduce a round-off error.

Also note that editing (or transferring) a vector when in
cylindrical or spherical coordinate display mode may also change
it slightly due to rounding off.

But here are the relevant entry points for the 49 series:

30E79 %REC>%POL ( %x %y -> %r %ang )
30EA6 %POL>%REC ( %r %ang -> %x %y )
30EDD %SPH>%REC ( %r %ang %ph -> %x %y %z )
Or for the 48 series:
2B48E %REC>%POL ( %x %y -> %r %ang )
2B4BB %POL>%REC ( %r %ang -> %x %y )
2B4F2 %SPH>%REC ( %r %ang %ph -> %x %y %z )
In SysRPL, "%" signs generally mean "real" numbers, and of course
the entry points are in hex notation, so for an R->P command, 2
real numbers are required for arguments, and the SYSEVAL sequence
for the 49 series would be:
#30E79h SYSEVAL
For the 49 series, the calculators have an MASD SysRPL/Assembly
compiler/decompiler built-in. Ordinarily, this is used with an
extable library so that named mnemonics can be used, but even
without extable, you can still use numeric entry points.

Source code for some 49 series SysRPL programs, with argument
checking:

%%HP: ;         @ ASCII transfer header
@ R\->P, with extable:
"!NO CODE
!RPL
:: (Begin secondary)
CK2NOLASTWD (2 arguments required)
CK&DISPATCH1 (Strips tags and convert zints to reals, if needed)
2REAL (2 reals?)
%REC>%POL (convert)
; (End secondary)
@"
%%HP: ;         @ ASCII transfer header
@ R\->P, without extable:
"!NO CODE
!RPL
::
PTR 2629C (CK2NOLASTWD)
PTR 26328 (CK&DISPATCH1)
# 11 (2REAL)
PTR 30E79 (%REC>%POL)
;
@"
%%HP: ;         @ ASCII transfer header
@ P\->R, with extable:
"!NO CODE
!RPL
:: (Begin secondary)
CK2NOLASTWD (2 arguments required)
CK&DISPATCH1 (Strips tags and convert zints to reals, if needed)
2REAL (2 reals?)
%POL>%REC (convert)
; (End secondary)
@"
%%HP: ;         @ ASCII transfer header
@ P\->R, without extable:
"!NO CODE
!RPL
::
PTR 2629C (CK2NOLASTWD)
PTR 26328 (CK&DISPATCH1)
# 11 (2REAL)
PTR 30EA6 (%POL>%REC)
;
@"
%%HP: ;         @ ASCII transfer header
@ S\->R, with extable:
"!NO CODE
!RPL
:: (Begin secondary)
CK3NOLASTWD (3 arguments required)
CK&DISPATCH1 (Strips tags and convert zints to reals, if needed)
# 111 (3 reals?)
%SPH>%REC (convert)
; (End secondary)
@"
%%HP: ;         @ ASCII transfer header
@ S\->R, without extable:
"!NO CODE
!RPL
::
PTR 262A1 (CK3NOLASTWD)
PTR 26328 (CK&DISPATCH1)
# 111
PTR 30EDD (%SPH>%REC)
;
@"

You can copy and paste the source code (beginning with the
"%%HP: ;" ASCII transfer headers) to files, and transfer them to a
49 series.

To compile the above source code with extable installed, put the
string on the stack and execute ASM; to decompile a SysRPL program
to a string, put the program on the stack and execute \->S2.

To do it without extable, you'll have to use one of the strings
without mnemonics. Assuming that the development library (256)
(which installing extable automatically attaches) isn't attached,
execute 256.06 MENU, and then press the ASM menu key.

The !NO CODE and !RPL lines are compiler directives. If you set
flag -92 (MASD SysRPL mode), then they can be omitted.

If you set flag -85 (SysRPL stk disp), then the programs (and
everything else) are displayed on the stack (but not in the
command line editor) in SysRPL mode.

Note that MASD requires the "@" to be the only character in the
last line of the string.

I'd encourage anyone interested to see
Programming
in System RPL Second Edition

For the 48 series, you'd have to use a different compiler. Maybe try a
search at http://www.hpcalc.org/, but
Debug4x should be a good
PC-based compiler for any 48/49 series.

A useful cross-reference of 48 and 49 series entry points can be
found at http://www.hpcalc.org/details.php?id=3248

The official HP extable library for the 49 series can be found at
http://www.hpcalc.org/details.php?id=3245, or extable2 (also
includes "unsupported but stable" entry points) can be found at
http://staff.science.uva.nl/~dominik/hpcalc/

Regards,
James

Edited: 14 Jan 2007, 12:16 a.m.


Forum Jump: