Message Boards Message Boards

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

Converting from one coordinate system to another?

Posted 8 years ago

In using the CoordinateTransformData[] and CoordinateTransform[] commands I get totally different results from what I expect (see attached), and I can not understand why. In reviewing the documentation, it appears that I am using the commands for the right purpose, but they don't seem to give the correct answer.

I always prefer to use different techniques to verify my answers and find it somewhat troubling that I am getting two different answers. Could someone please tell me what I am doing incorrectly.

Thanks,

Attachments:
POSTED BY: Mitchell Sandlin
2 Replies

You may have reversed the meaning of theta and phi.

POSTED BY: Gianluca Gorni
Posted 8 years ago

Hi Mitchell,

The short answer is that you are using a slightly different convention for spherical coordinate than what is in Wolfram Language.

CoordinateTransform[{"Spherical" -> "Cartesian", 3}, {\[Rho], \[Theta], \[Phi]}]

shows that theta and phi role are switch in your equations and CoordinateTransform.

Slightly longer answer, unfortunately, in the example you have provided, you cannot simply switch theta and phi

CoordinateTransformData["Spherical" -> "Cartesian", "Mapping", {12, 0, Pi/4}]

because spherical has a range assumption

In[55]:= CoordinateChartData["Spherical", "CoordinateRangeAssumptions"]

Out[55]= #1[[1]] > 0 && 0 < #1[[2]] < \[Pi] && -\[Pi] < #1[[3]] <= \[Pi] &

but this will give the desired output:

CoordinateTransformData["Spherical" -> "Cartesian", "Mapping", {12, \[Theta], Pi/4}] /. \[Theta] -> 0

Hope this helped.

POSTED BY: Wilson Kan
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