Converting Polar and Rectangular
05-05-2022, 05:05 AM
Post: #1
 IsaiahG0701 Junior Member Posts: 9 Joined: Mar 2022
Converting Polar and Rectangular
I’m having trouble downloading a certain program for my hp prime. Every time I type in the programs below I get a syntax error. Is there anyone that has a link where I can download these programs rather than manually put them in?

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;
05-05-2022, 02:30 PM
Post: #2
 matalog Member Posts: 208 Joined: May 2021
RE: Converting Polar and Rectangular

EXPORT P_2_R(x,y)

Or something instead of your first lines?

If you try it on a calculator, it will tell you where the problem is, by clicking Info after running the program, or clicking Check, when in writing the program.
05-05-2022, 04:07 PM (This post was last modified: 05-05-2022 04:20 PM by Didier Lachieze.)
Post: #3
 Didier Lachieze Senior Member Posts: 1,524 Joined: Dec 2013
RE: Converting Polar and Rectangular
These are CAS programs, you need to add #cas and #end statements:

Code:
#cas 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;  #end

Btw, you can use instead of these programs the built-in functions rectangular_coordinates() and polar_coordinates() as explained here.
 « Next Oldest | Next Newest »

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