Help with conversion from rectangular to spherical coordinates

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
4 replies · 3K views
yungman
Messages
5,741
Reaction score
291
This is not a homework. Actual this is part of my own exercise on conversion where [itex]\vec A = \vec B \;X\; \vec C[/itex] and I intentionally set up B and C so the [itex]\theta_B \hbox { and } \theta_C \;=\; 60^o \;[/itex] respect to z-axis:

[tex]\vec B_{(x,y,z)} = (2,4, 2\sqrt{(\frac 5 3)}) \;\;\hbox { and }\;\; \vec C = (4,2, 2\sqrt{(\frac 5 3)})[/tex]

[tex]\vec A_{(x,y,z)} = \hat x 4\sqrt{\frac 5 3} \;+\; \hat y 4\sqrt{\frac 5 3} -\hat z 12[/tex]

I want to find A in spherical coordinate:

[tex]|\vec A_{(x,y,z)}| = \sqrt { x_A^2 +y_A^2 +z_A^2} = \sqrt{ 16\frac 5 3 \;+\; 16\frac 5 3 \;+\; 144} \;=\;14.04754[/tex]

[tex]\phi = tan^{-1} (\frac y x) \;=\; 45^o \;\;\hbox { and }\;\; \theta = tan{-1}(\frac {\sqrt{x^2+y^2}}{z}) = tan{-1}(\frac {7.30297}{-12}) = -31.324^o \Rightarrow \theta = 180-31.324=148.676^o[/tex]

Or using cosine to find [itex]\theta[/itex]:

[tex]\theta = cos ^{-1}(\frac { z}{|\vec A|}) = cos ^{-1}( \frac {-12}{14.04754})= 148.676^o[/tex]

[tex]\Rightarrow \; cos \phi = sin\phi = 0.7071 \;\;\hbox { and }\;\; cos \theta = -0.85424 \;\;\hbox { and }\;\; sin \theta = 0.5198[/tex]



Given equation of the [itex]\hat {\theta}[/itex] component:

[tex]A_{\theta} \;=\; A_x cos \theta cos \phi \;+\; A_y cos \theta sin\phi \;-\; A_z sin \theta[/tex]

[tex]\Rightarrow\; A_{\theta} \;=\; 4\sqrt{\frac 5 3} X (-0.85824) X 0.7071 \;+\; 4\sqrt{\frac 5 3} X (-0.85824) X 0.7071 \;-\;12 X (0.5198) \;=\; -6.23843 -6.2376 \;=\; -12.476[/tex]

For a position vector:

[tex]\vec A \;=\; \hat R A_R[/tex]

Both [itex]A_{\theta } \;\;\hbox { and }\;\; A_{\phi} \;=\;0[/itex], no exception! But as you can see, [itex]A_{\theta }[/itex] is not zero. I double check my work, I cannot see any error. Please tell me what am I missing.

Thanks
 
Last edited:
Physics news on Phys.org
hi yungman! :smile:
yungman said:
[tex]\theta = tan{-1}(\frac {\sqrt{x^2+y^2}}{z}) = tan{-1}(\frac {7.30297}{-12}) = -31.324^o \Rightarrow \theta = 180-31.324=148.676^o[/tex]

nooo :redface:

tan-1(-A) = -tan-1(A) :wink:
 
tiny-tim said:
hi yungman! :smile:


nooo :redface:

tan-1(-A) = -tan-1(A) :wink:

Hi Tiny-Tim
Thanks for the reply.

But in Spherical coordiantes, [itex]\theta[/itex] is measure from the z-axis, when z=-12, [itex]\theta[/itex] has to be larger than 90 deg.

This is part of a conversion I am doing. where [itex]\vec A = \vec B X \vec C[/itex]. I just edit the original post to reflect this. I started with [itex]\theta[/itex] of both B and C are 60 deg. respect to z-axis.

Also another way to find the angles is:

[tex]\theta = cos ^{-1}(\frac { z}{|\vec A|}) = cos ^{-1} \frac {-12}{14.04754}= 148.676^o[/tex]
 
Last edited:
yungman said:
This is not a homework. Actual this is part of my own exercise on conversion where [itex]\vec A = \vec B \;X\; \vec C[/itex] and I intentionally set up B and C so the [itex]\theta_B \hbox { and } \theta_C \;=\; 60^o \;[/itex] respect to z-axis:

[tex]\vec B_{(x,y,z)} = (2,4, 2\sqrt{(\frac 5 3)}) \;\;\hbox { and }\;\; \vec C = (4,2, 2\sqrt{(\frac 5 3)})[/tex]

[tex]\vec A_{(x,y,z)} = \hat x 4\sqrt{\frac 5 3} \;+\; \hat y 4\sqrt{\frac 5 3} -\hat z 12[/tex]

I want to find A in spherical coordinate:

[tex]|\vec A_{(x,y,z)}| = \sqrt { x_A^2 +y_A^2 +z_A^2} = \sqrt{ 16\frac 5 3 \;+\; 16\frac 5 3 \;+\; 144} \;=\;14.04754[/tex]

[tex]\phi = tan^{-1} (\frac y x) \;=\; 45^o \;\;\hbox { and }\;\; \theta = tan{-1}(\frac {\sqrt{x^2+y^2}}{z}) = tan{-1}(\frac {7.30297}{-12}) = -31.324^o \Rightarrow \theta = 180-31.324=148.676^o[/tex]

Or using cosine to find [itex]\theta[/itex]:

[tex]\theta = cos ^{-1}(\frac { z}{|\vec A|}) = cos ^{-1}( \frac {-12}{14.04754})= 148.676^o[/tex]

[tex]\Rightarrow \; cos \phi = sin\phi = 0.7071 \;\;\hbox { and }\;\; cos \theta = -0.85424 \;\;\hbox { and }\;\; sin \theta = 0.5198[/tex]



Given equation of the [itex]\hat {\theta}[/itex] component:

[tex]A_{\theta} \;=\; A_x cos \theta cos \phi \;+\; A_y cos \theta sin\phi \;-\; A_z sin \theta[/tex]

[tex]\Rightarrow\; A_{\theta} \;=\; 4\sqrt{\frac 5 3} X (-0.85824) X 0.7071 \;+\; 4\sqrt{\frac 5 3} X (-0.85824) X 0.7071 \;-\;12 X (0.5198) \;=\; -6.23843 -6.2376 \;=\; -12.476[/tex]

For a position vector:

[tex]\vec A \;=\; \hat R A_R[/tex]

Both [itex]A_{\theta } \;\;\hbox { and }\;\; A_{\phi} \;=\;0[/itex], no exception! But as you can see, [itex]A_{\theta }[/itex] is not zero. I double check my work, I cannot see any error. Please tell me what am I missing.

Thanks

I found my problem. It is a stupid sign mistake.

[tex]\Rightarrow\; A_{\theta} \;=\; 4\sqrt{\frac 5 3} X (-0.85824) X 0.7071 \;+\; 4\sqrt{\frac 5 3} X (-0.85824) X 0.7071 \;-\;(-12) X (0.5198) \;=\; -6.23843 +6.2376 \;=\; 0[/tex]

The z term is where my error is. Thanks.
 
Ok, now that I got over the stupid thing I did. I can get back to my main experiment. My goal is to compare the result of:

[tex]\vec B \;X \;\vec C \;=\; \vec A[/tex]

I use two different approaches and proof that they don't get the same answer. The approaches are:

a) By perform the cross product in rectangular coordinates and then transform into spherical coordinates as show in the original post #1.

b) By transform both B and C first into spherical coordinate before perform cross product.



a) First approach: Refer to post #1:

[tex]A_R = \vec A_{(x,y,z)} \cdot \hat R \;=\; A_x sin \theta cos \phi \;+\; A_y sin \theta sin \phi \;+\; A_z cos \theta = 14.046926[/tex]

Both [itex]\vec A_{\theta}=\vec A_{\phi}=0[/itex] therefore:

[tex]\vec A \;=\; \hat R A_R \;=\; \hat R 14.046926[/tex]



b) Second approach: we transform both B and C to spherical coordinates before performing the cross product:
Using the same formula above, both [itex]\vec B_R = \vec C_R = \hat R 5.163746[/itex].

[tex]\vec B = \hat R B_R \;\;\hbox { and } \;\; \vec C = \hat R C_R[/tex]


As you can see, both only has the [itex]\hat R[/itex] components only as expected from a position vector.

[tex]\vec B \;X\; \vec C \;=\; \left|\begin{array}{ccc}\hat R & \hat \theta & \hat \phi \\B_R & 0 & 0\\ C_R & 0 & 0\end{array}\right|= 0[/tex]

This imply you get a total different answer in two different procedures. It is my understanding you can perform the cross product either way but obviously it does not work. Please take a look and see what did I do wrong.

Thanks

Alan
 
Last edited: