Message Boards Message Boards

0
|
7663 Views
|
12 Replies
|
2 Total Likes
View groups...
Share
Share this post:

PolarConversiion

Posted 10 years ago

In Mathematica, how can I convert an equation written in Polar coordinates to Cartesian coordinates with x and y values?

POSTED BY: John Lutz
12 Replies
Posted 10 years ago

You could use the usual substitution. I use ArcTan[y,x] rather than ArcTan[y/x] because it accounts for the quadrant.

* Below edited to correct error *

In[1]:= fromPolarRule = {r -> Sqrt[x^2 + y^2], \[Theta] -> 
    ArcTan[x,y]};

In[2]:= eq = r Cos[\[Theta]] == r Sin[\[Theta]];

In[3]:= eqxy = eq /. fromPolarRule

Out[3]= x == y
POSTED BY: David Keith
Posted 10 years ago

I can do it on paper. I worded my question poorly. What I am looking for is a Mathematica command that will do this. Some commands will convert to polar but I haven't found one that converts to Cartesian. Thanks

POSTED BY: John Lutz
Posted 10 years ago

Perhaps CoordinateTransform?

CoordinateTransform["Polar" -> "Cartesian", {r, \[Theta]}]
(* => {r Cos[\[Theta]], r Sin[\[Theta]]} *)
POSTED BY: Alexey Popkov
Posted 10 years ago

The built-in functions I'm aware of (CoordinateTransform (above) and FromPolarCoordinates) operate on vectors, not equations. Perhaps you could say more about the application.

POSTED BY: David Keith

enter image description here

POSTED BY: Simon Cadrin

enter image description here

POSTED BY: Simon Cadrin
Posted 10 years ago

TransformedField[ "Polar" -> "Cartesian", [(r^2)* Cos[[Theta]]], {r, [Theta]} -> {x, y}]

Syntax::sntxf: "TransformedField[Polar->Cartesian," cannot be followed by "[(r^2)*Cos[[Theta]]],{r,[Theta]}->{x,y}]". I am taking a calculus course on "Great Courses". On the Polar part of the course he shows how to convert an expression written in Polar Coordinate to Cartesian Coordinates. I still can't do this in Mathematica. I took the suggestion to try TransformedField. As you can see, I can't execute the example shown on the Help page. Do I have to load some kind of package before executing what I am trying to do. It doesn't look like it. A few years age I used Mathematica a lot. But now I am rusty. I my Trig book the show an example: r=@/(1-Cos(theta)) Converts to Y^2=4x+4. I have done polarplots ,successfully, in Mathematica on everything I am I am trying yo convert.

You help is appreciated.

Can I supply more info?

POSTED BY: John Lutz

In regard to David Keith's fromPolarRule, note that ArcTan[y, x] should read ArcTan[x, y].

POSTED BY: Eric Johnstone
Posted 10 years ago

Well, after 20+ year using Mathematica I still learn something new every day. ;-)

The only thing wrong with your use of Transform field above is too many brackets, although code not in a code block sometimes gets mangled in a posting.

Below is a use of the built-in function you found, as well as an example of making your own, which is one of Mathematica's real strengths.

* and note that in my earlier post above I incorrectly used ArcTan[y,x] rather than ArcTan[x,y] *

In[1]:= (* with the built-in function *)
TransformedField[
 "Polar" -> "Cartesian", (r^2) Cos[theta], {r, theta} -> {x, y}]

Out[1]= x Sqrt[x^2 + y^2]

In[2]:= (* doing it with a Rule and Replace works also *)
fromPolarRule = {r -> Sqrt[x^2 + y^2], theta -> ArcTan[x, y]};

In[3]:= (* and we can use it to define a function *)
myTransformedField[expression_] := expression /. fromPolarRule

In[4]:= myTransformedField[(r^2) Cos[theta]]

Out[4]= x Sqrt[x^2 + y^2]
POSTED BY: David Keith
Posted 10 years ago

Thanks David. That worked! I finally have the conversion.

POSTED BY: John Lutz
Posted 10 years ago

Thanks, Eric -- I edited it to correct the error.

POSTED BY: David Keith
Posted 10 years ago

David, I implemented your myTransformedField function. It is great. Years ago I bought a software package called Scientific Notebook by MacKichan Software Inc. It is a very user friendly front end to the old Maple version 5.5. It is no longer being upgraded. I wish someone would look at it to see the features and concept. Maybe something like it could be done for Mathematica.

Thanks again.

POSTED BY: John Lutz
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract