(48g) (49g) (50g) Rectangular to Polar Coordinate Conversion [RPL]
12-12-2013, 04:43 PM (This post was last modified: 06-15-2017 01:30 PM by Gene.)
Post: #1
 Michael de Estrada Senior Member Posts: 373 Joined: Dec 2013
(48g) (49g) (50g) Rectangular to Polar Coordinate Conversion [RPL]
Although these two little RPL programs will work on the HP 28C/S, they are intended for later RPL calculators such as the HP 48S and HP 50g which lack this capability. Both programs accept the input parameters in the form of a complex number and return the results as individual values into the stack.

Rectangular to Polar Coordinates:

<< DUP ARG SWAP ABS >>

Example: (3,4) --> 5 in stack level 1 and 53.13 in stack level 2 (degrees)

Polar to Rectangular Coordinates:

<< DUP DUP RE SWAP IM SIN * SWAP DUP RE SWAP IM COS * >>

Example: (5,53.13) --> 3 in stack level 1 and 4 in stack level 2 (degrees)
12-13-2013, 08:58 AM (This post was last modified: 12-13-2013 09:11 AM by Joe Horn.)
Post: #2
 Joe Horn Senior Member Posts: 2,001 Joined: Dec 2013
RE: Rectangular to Polar Coordinate Conversion [RPL]
Here's an alternate approach for Polar to Rectangular for HP 48/49/50, but it takes the inputs on two levels, not as a single complex number:

« -16 SF V2 -16 CF V »

<0|ɸ|0>
-Joe-
12-15-2013, 03:55 AM
Post: #3
 Michael de Estrada Senior Member Posts: 373 Joined: Dec 2013
RE: Rectangular to Polar Coordinate Conversion [RPL]
That's actually very elegant and more in line with the methodology of calculators with direct conversion keys such as the HP 33s. The conversion in the other direction for rectangular to polar representation is:

<< -16 CF ->V2 -16 SF V-> >>
12-17-2013, 06:30 AM
Post: #4
 Han Senior Member Posts: 1,882 Joined: Dec 2013
RE: Rectangular to Polar Coordinate Conversion [RPL]
The only problem is that it does not preserve the user's original flag settings. A quick RCLF UNROT at the beginning and SWAP STOF at the end should fix it.

Graph 3D | QPI | SolveSys
12-17-2013, 03:52 PM
Post: #5
 Michael de Estrada Senior Member Posts: 373 Joined: Dec 2013
RE: Rectangular to Polar Coordinate Conversion [RPL]
(12-17-2013 06:30 AM)Han Wrote:  The only problem is that it does not preserve the user's original flag settings. A quick RCLF UNROT at the beginning and SWAP STOF at the end should fix it.

Well, you are correct about the UNROT at the beginning, but you need a ROT rather than a SWAP at the end to get the correct stack order.
06-03-2014, 10:49 AM (This post was last modified: 06-03-2014 11:20 AM by CosmicTruth.)
Post: #6
 CosmicTruth Member Posts: 164 Joined: May 2014
RE: Rectangular to Polar Coordinate Conversion [RPL]
nice

Code:
 'R2P' %%HP: T(3)A(D)F(.); \<< RCLF UNROT -16. CF \->V2 -16. SF V\-> ROT STOF \>> 'P2R' %%HP: T(3)A(D)F(.); \<< RCLF UNROT -16. SF \->V2 -16. CF V\-> ROT STOF \>>
Want to take on matrix to area by Gauss's shoelace next? I'd dig it...

Thanks
~~~~8< Art >8~~~~

PS: Please post more 50G stuff :)
06-03-2014, 11:19 AM
Post: #7
 HP67 Senior Member Posts: 694 Joined: Dec 2013
RE: Rectangular to Polar Coordinate Conversion [RPL]
Alternatively, on the 50g PUSH ... POP

It ain't OVER 'till it's 2 PICK
06-03-2014, 11:16 PM
Post: #8
 CosmicTruth Member Posts: 164 Joined: May 2014
RE: Rectangular to Polar Coordinate Conversion [RPL]
(06-03-2014 11:19 AM)HP67 Wrote:  Alternatively, on the 50g PUSH ... POP

Code:
 %%HP: T(3)A(D)F(.); \<< PUSH -16. CF \->V2 -16. SF V\-> POP \>> 'P2R' %%HP: T(3)A(D)F(.); \<< PUSH -16. SF \->V2 -16. CF V\-> POP \>>

I like push-pops

Thanks
~~~~8< Art >8~~~~

PS: Please post more 50G stuff :)
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)