Rectangular to Polar Coordinate Conversion
12-12-2013, 01:14 AM
Post: #1
 Michael de Estrada Senior Member Posts: 366 Joined: Dec 2013
Rectangular to Polar Coordinate Conversion
These are both User Functions, rather than programs per se. They work properly in both Home and CAS view.

Rectangular to Polar Coordinate Conversion:

Name: P_coord
Function: ABS(X+Y*i)+ARG(X+Y*i)*i
Usage: P_coord(3,4)-->(5,53.13) or 5+53.13*i with angular mode set to degrees

Polar to Rectangular Coordinate Conversion:

Name: R_coord
Function: (X*COS(Y))+(X*SIN(Y))*i
Usage: R_coord(5,53.13)-->(3,4) or 3+4*i with angular mode set to degrees
08-28-2017, 04:40 PM
Post: #2
 lschroeder1947 Member Posts: 68 Joined: Apr 2017
RE: Rectangular to Polar Coordinate Conversion
With HP Prime Free User Functions are available. Granddaughter has HP Prime calculator but other students wanting to use HP Prime in her AP physics will need to use the HP Prime Free app on their iPhone, Android phone, or iPad, Android, or Window's tablet

Going to use direct entry plus defined functions to solve math and physic vector problems.

As Tim Wessman posted elsewhere we can use direct input complex rectangular and polar forms from HOME view.

From HOME view we will use complex rectangle <num>+<num><i> and complex polar <num. <angle><num> The angle symbol is on the shift multiple key. We will use these two of the four methods TW showed for direct entry. Use the <angle> key to toggle history results between rectangular and polar form.

Used modified Michael Post for CAS and HOME view. Changed his names to RtoP and PtoR, Added RtoP_angle so his method displayed <angle> symbol. This caused the modified RtoP_angle to loose simplifications of his original RtoP. Needed the CAS.exact for <angle> modification to work.

Name: RtoP_angle
Function: CAS.exact(ABS(X+Y*i))+"∡"+ARG(X+Y*i)

Added these modifications to fix RtoP_angle problems.

Name: R_to_P
Function: CAS.exact(CAS.collect(ABS(X+Y*i)))+"∡"+CAS.collect(ARG(X+Y*i)) Name: P_to_R
Function: CAS.exact(X*COS(Y))+CAS.exact(X*SIN(Y))*i Use your Define blue key with system copy and paste to set your User Functions to these values. Used the upper right hand icon to toggle between radian and degrees. <arrow> key not useful for toggling defined functions results.

Larry Schroeder
08-29-2017, 05:12 AM
Post: #3
 Anders Member Posts: 111 Joined: May 2014
RE: Rectangular to Polar Coordinate Conversion
Yeah, so great that you are all creating functions for something that in my opinion should be built in to the HP Prime CAS from the beginning especially since there is a dedicated ∡ button!

So I am restating what I wrote in another post.

In CAS mode:
1) How about enabling ∡ so it does polar arithmetic algebraically exact. e.g. 2∡(π/6) * 3∡(π/6) = 6∡(π/3), (2∡(π/6))^2 = 4∡(π/3) etc for at least +,-,*, / ^ . I mean the calculations should be done exact using built in CAS functions.

2) Also, how about enabling the ∡ button to shift what's in "Ans" between polar and rectangular/Cartesian form algebraically when pressed on it's own (like it does in Home view but in decimal form). e.g. with 4∡(π/3) in Ans pressing ∡ would show 2+2*√3*i pressing ∡ again would return to 4∡(π/3).

It is really not that hard to do. Since all the building blocks are already built into the libraries in CAS, all you need to do is to build some simple functions calls and assign to ∡ ....

This would make life really easy for the high school student taking AP Physics and Calculus (and at collage).
10-24-2017, 10:55 AM (This post was last modified: 12-30-2017 09:50 AM by lschroeder1947.)
Post: #4
 lschroeder1947 Member Posts: 68 Joined: Apr 2017
RE: Rectangular to Polar Coordinate Conversion
Anders said:
Quote:...that in my opinion should be built in to the HP Prime CAS from the beginning especially since there is a dedicated ∡ button!...

Anders, that would be nice. Here is simplified version of my post to make it easier for HP Prime Free - Lite users to follow.

Note: HOME view conversions of Polar to Rectangular and Rectangular to Polar are built-in.

Alternate Approach below seems to be more stable.

Implement CAS View versions: Press Define, type Name, and copy Function

Name:P_to_R
Function: CAS.exact(X*COS(Y))+CAS.exact(X*SIN(Y))*i

Name: R_to_P
Function: CAS.exact(CAS.collect(ABS(X+Y*i)))+"∡"+CAS.collect(ARG(X+Y*i))

<Edit 1 - Dec 26, 2017>

Alternate Approach - using CAS variables with local paramenters
Copy each of these functions to the CAS command line and press enter (BEGIN, return, ENTER necessary for Windows Store version of Free - used for iOS Lite and Android Free as well):

P_to_R(r,a):=
BEGIN
return (r*COS(a)+r*SIN(a)*i);
END;

R_to_P(x,y):=
BEGIN
return (CAS(collect(ABS(x+y*i)))+"∡"+CAS(collect(ARG(x+y*i))));
END;

</Edit 1>  Use your Define blue key with system copy and paste to set your User Functions to these values. Use the upper right hand icon to toggle between radian and degrees. Use <approximate> key if necessary. <arrow> key does not toggle CAS defined functions results.
 « Next Oldest | Next Newest »

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