Help with conversion from rectangular to spherical coordinates

In summary, the conversation discusses the process of finding the position vector in spherical coordinates by given values of vectors B and C and vector A in rectangular coordinates. Two different approaches were used: the first approach involves finding the magnitude of A in spherical coordinates and using that to find the position vector, while the second approach transforms B and C into spherical coordinates before performing the cross product. However, the results of the two approaches do not match, indicating a mistake in the calculations. The conversation ends with a request for help in identifying the error.
  • #1
yungman
5,723
242
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
  • #2
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:
 
  • #3
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:
  • #4
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.
 
  • #5
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:

Related to Help with conversion from rectangular to spherical coordinates

1. What are rectangular coordinates?

Rectangular coordinates, also known as Cartesian coordinates, are a way of representing points in a three-dimensional space using three numbers: x, y, and z. These numbers represent the distances along the x, y, and z axes, respectively, from the origin point (0,0,0).

2. What are spherical coordinates?

Spherical coordinates are another way of representing points in a three-dimensional space. Instead of using x, y, and z coordinates, spherical coordinates use three quantities: radius (r), inclination (θ), and azimuth (φ). These quantities represent the distance from the origin, the angle between the point and the positive z-axis, and the angle between the projection of the point onto the xy-plane and the positive x-axis, respectively.

3. Why would I need to convert from rectangular to spherical coordinates?

Converting from rectangular to spherical coordinates can be useful in many situations, such as in physics, engineering, and navigation. It allows you to represent and analyze points in a different coordinate system, which may be more convenient or appropriate for a particular problem or application.

4. How do I convert from rectangular to spherical coordinates?

To convert from rectangular to spherical coordinates, you can use the following formulas:

r = √(x² + y² + z²)

θ = arccos(z/r)

φ = arctan(y/x)

These formulas use trigonometric functions to calculate the values of radius, inclination, and azimuth based on the given x, y, and z coordinates.

5. Are there any other coordinate systems I should know about?

Yes, there are many other coordinate systems that are used in different fields of study. Some examples include cylindrical coordinates, polar coordinates, and curvilinear coordinates. It is important to understand the differences between these coordinate systems and know how to convert between them if necessary.

Similar threads

Replies
1
Views
3K
  • Differential Equations
Replies
4
Views
2K
  • Calculus and Beyond Homework Help
Replies
3
Views
607
  • Advanced Physics Homework Help
Replies
9
Views
2K
  • Advanced Physics Homework Help
Replies
1
Views
824
  • Introductory Physics Homework Help
Replies
10
Views
317
Replies
33
Views
3K
  • Calculus and Beyond Homework Help
Replies
7
Views
718
  • Advanced Physics Homework Help
Replies
1
Views
533
  • Introductory Physics Homework Help
Replies
21
Views
1K
Back
Top