Help with conversion from rectangular to spherical coordinates

yungman
Messages
5,741
Reaction score
294
This is not a homework. Actual this is part of my own exercise on conversion where \vec A = \vec B \;X\; \vec C and I intentionally set up B and C so the \theta_B \hbox { and } \theta_C \;=\; 60^o \; respect to z-axis:

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

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

I want to find A in spherical coordinate:

|\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

\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

Or using cosine to find \theta:

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

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



Given equation of the \hat {\theta} component:

A_{\theta} \;=\; A_x cos \theta cos \phi \;+\; A_y cos \theta sin\phi \;-\; A_z sin \theta

\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

For a position vector:

\vec A \;=\; \hat R A_R

Both A_{\theta } \;\;\hbox { and }\;\; A_{\phi} \;=\;0, no exception! But as you can see, A_{\theta } 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:
\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

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, \theta is measure from the z-axis, when z=-12, \theta has to be larger than 90 deg.

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

Also another way to find the angles is:

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

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

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

I want to find A in spherical coordinate:

|\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

\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

Or using cosine to find \theta:

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

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



Given equation of the \hat {\theta} component:

A_{\theta} \;=\; A_x cos \theta cos \phi \;+\; A_y cos \theta sin\phi \;-\; A_z sin \theta

\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

For a position vector:

\vec A \;=\; \hat R A_R

Both A_{\theta } \;\;\hbox { and }\;\; A_{\phi} \;=\;0, no exception! But as you can see, A_{\theta } 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.

\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

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:

\vec B \;X \;\vec C \;=\; \vec A

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:

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

Both \vec A_{\theta}=\vec A_{\phi}=0 therefore:

\vec A \;=\; \hat R A_R \;=\; \hat R 14.046926



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

\vec B = \hat R B_R \;\;\hbox { and } \;\; \vec C = \hat R C_R


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

\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

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:
Thread 'Direction Fields and Isoclines'
I sketched the isoclines for $$ m=-1,0,1,2 $$. Since both $$ \frac{dy}{dx} $$ and $$ D_{y} \frac{dy}{dx} $$ are continuous on the square region R defined by $$ -4\leq x \leq 4, -4 \leq y \leq 4 $$ the existence and uniqueness theorem guarantees that if we pick a point in the interior that lies on an isocline there will be a unique differentiable function (solution) passing through that point. I understand that a solution exists but I unsure how to actually sketch it. For example, consider a...
Back
Top