Convert from rectangular to Spherical Coordinates

Yes, that is what I was confused about. Thanks for the help!In summary, the conversion from Cartesian coordinates to Spherical coordinates involves expressing the Cartesian position vector in terms of the spherical basis vectors, with the radial component being represented by the unit vector in the radial direction, and the azimuthal and polar components being represented by the unit vectors along the arcs of the respective angles.
  • #1
Philosophaie
462
0
How do you convert this to Spherical Components?

Spherical Convention = (radial, azimuthal, polar)

##\vec r = |\vec r| * \cos{(\theta)} * \sin{(\phi)} * \hat x +|\vec r| * \sin{(\theta)} * \sin{(\phi)} * \hat y +|\vec r| * \cos{(\phi)} * \hat z##

Is this correct?

##\vec r =\sqrt{(x^2 + y^2 + z^2)} * \hat r + \arctan{(\frac{y}{x})} * \hat \theta + \arccos{(\frac{z}{r})} * \hat \phi##
 
Mathematics news on Phys.org
  • #2
No, it is not correct. Please show your work.
 
  • #3
Cartisian Coordinates
##\vec r = x * \hat x + y * \hat y + z * \hat z##
##x = |\vec r| \cos{\theta} \sin{\phi}##
##y = |\vec r| \sin{\theta} \sin{\phi}##
##z = |\vec r| \cos{\phi}##
Spherical Coordinates
##r = \sqrt{(x^2 + y^2 + z^2)}##
##\theta = \arctan{(\frac{y}{x})}##
##\phi = \arccos{(\frac{z}{r})}##
##\vec r = r \hat r + \theta \hat \theta + \phi \hat \phi##
or is it
##\vec r = r \hat r + \frac{\theta}{r\sin{\phi}} \hat \theta +\frac{\phi}{r} \hat \phi##
 
  • #4
Philosophaie said:
##\vec r = r \hat r + \theta \hat \theta + \phi \hat \phi##
or is it
##\vec r = r \hat r + \frac{\theta}{r\sin{\phi}} \hat \theta +\frac{\phi}{r} \hat \phi##

Neither of those is correct. You are even adding vectors with different physical dimension ... I suggest you express the Cartesian basis vectors in terms of the spherical basis vectors and start from the Cartesian expression for the position vector.
 
  • #5
What would be the expression in terms of Spherical Coordinates
##\vec r = r(x,y,z) \hat r + \theta(x,y,z) \hat \theta + \phi(x,y,z) \hat \phi##
##r(x,y,z)=?##
##\theta(x,y,z)=?##
##\phi(x,y,z)=?##
 
  • #6
Why don't you try drawing it out? As you said, in Cartesian Coordinates the position vector is [itex]\vec r = x * \hat x + y * \hat y + z * \hat z[/itex]. When you draw this out, in what direction is it pointing in spherical coordinates? How much of it is pointing along the r, θ, and φ unit vectors?
 
  • #7
If I draw it out the Spherical Coordinates are:
##r = \sqrt{(x^2 + y^2 + z^2)}##
##\theta = \arctan{(\frac{y}{x})}##
##\phi = \arccos{(\frac{z}{r})}##
##\vec r = r \hat r + \theta \hat \theta + \phi \hat \phi##
##\hat \theta## and ##\hat \phi## are along the arcs.
 
  • #8
Philosophaie said:
##\hat \theta## and ##\hat \phi## are along the arcs.

Right. So if I decompose the Cartesian position vector into the spherical coordinate unit vectors, how much of the Cartesian position vector points along these arcs?
 
  • #9
Philosophaie said:
=√(x2+y2+z2)r=(x2+y2+z2)r = \sqrt{(x^2 + y^2 + z^2)}
θ=arctan(yx)θ=arctan⁡(yx)\theta = \arctan{(\frac{y}{x})}
ϕ=arccos(zr)ϕ=arccos⁡(zr)\phi = \arccos{(\frac{z}{r})}
⃗r=r^r+θ^θ+ϕ^ϕr→=rr^+θθ^+ϕϕ^\vec r = r \hat r + \theta \hat \theta + \phi \hat \phi
Is correct then?
 
  • #10
##r = \sqrt{(x^2 + y^2 + z^2)}##
##\theta = \arctan{(\frac{y}{x})}##
##\phi = \arccos{(\frac{z}{r})}##
##\vec r = r \hat r + \theta \hat \theta + \phi \hat \phi##
is correct then?
 
  • #11
Philosophaie said:
##r = \sqrt{(x^2 + y^2 + z^2)}##
##\theta = \arctan{(\frac{y}{x})}##
##\phi = \arccos{(\frac{z}{r})}##
##\vec r = r \hat r + \theta \hat \theta + \phi \hat \phi##
is correct then?

No. You didn't answer my question.
 
  • #12
##\arctan{(\frac{y}{x})}## points in the ##\hat \theta## direction.
##\arccos{(\frac{z}{r})}## points in the ##\hat \phi## direction.
 
  • #13
Philosophaie said:
##\arctan{(\frac{y}{x})}## points in the ##\hat \theta## direction.
##\arccos{(\frac{z}{r})}## points in the ##\hat \phi## direction.
A scalar cannot "point" in any direction. You were asked to decompose the Cartesian basis vectors into the spherical ones in post #4 and to make the drawing with the position vector relative to a point in spherical coordinates twice in posts #6 and #8. I suggest that you follow either or both of these suggestions.
 
  • #14
Uncertain how to convert x,y,z to ##(\hat r, \hat \theta, \hat \theta)##. Can you give a hint?
 
  • #15
Are you familiar with how to express the spherical basis vectors in Cartesian coordinates?
 
  • #16
Look above. Post #1.
 
  • #17
Philosophaie said:
Look above.
You have not done so above.
 
  • #18
Have you drawn out the vectors yet? If so, can you post a picture?
 
  • #20
Attached is a drawing. r is in a 3d box or x,y,z. On the xy plane starting on x-axis is ##\theta## starting on the arc is ##\hat \theta## as a unit vector. On the z-xy plane directly down from r to the xy plane. Starting from the z-axis to r to the xy plane is ##\phi## starting on the arc ##\hat \phi## as a unit vector.
 

Attachments

  • SphericalFromCartesian_0001.jpg
    SphericalFromCartesian_0001.jpg
    63.8 KB · Views: 576
Last edited:
  • #21
I think you are confused between transforming the coordinates from Cartesian to spherical and transforming the unit vectors. Your earlier post on transforming the coordinates, below, is correct. But, as ChesterMiller has told you, the Cartesian position vector: [itex] \vec r = x * \hat x + y * \hat y + z * \hat z [/itex] in spherical coordinates is simply: [itex] \vec r = r * \hat r [/itex] . The unit vectors [itex] \hat \theta[/itex] and [itex] \hat \phi [/itex] are orthogonal to the Cartesian position vector, so their projection along the Cartesian position vector is zero.
Philosophaie said:
##r = \sqrt{(x^2 + y^2 + z^2)}##
##\theta = \arctan{(\frac{y}{x})}##
##\phi = \arccos{(\frac{z}{r})}##
 
  • #22
It would be better to look at the components or ##\vec{dr}## in spherical coordinates, rather than the components of ##\vec{r}##.
 
  • #23
So how do you emulate the radial component with ##\theta## and ##\phi## into one equation encompassing ##\hat r##, ##\hat \theta## and ##\hat \phi##?
 
  • #24
Philosophaie said:
So how do you emulate the radial component with ##\theta## and ##\phi## into one equation encompassing ##\hat r##, ##\hat \theta## and ##\hat \phi##?

How about [itex] \vec r = r*\hat r + 0* \hat \theta + 0 * \hat \phi[/itex] ?
 
  • #25
There is no direction for r.
 
  • #26
Do you mean [itex] \hat r [/itex]? It certainly does have a direction. It points radially outward from the spherical coordinate system origin. I'm still struggling to see where your confusion lies. Maybe it is this. In a Cartesian coordinate system the unit vectors point in the same direction everywhere. In a curvilinear coordinate system like spherical coordinates, the direction of the unit vectors varies from point to point, so the unit vector [itex] \hat r [/itex] points in different directions at different places. Could this be the point you are missing?
 
  • #27
Philosophaie said:
Attached is a drawing. r is in a 3d box or x,y,z. On the xy plane starting on x-axis is ##\theta## starting on the arc is ##\hat \theta## as a unit vector. On the z-xy plane directly down from r to the xy plane. Starting from the z-axis to r to the xy plane is ##\phi## starting on the arc ##\hat \phi## as a unit vector.
Your diagram should always be the first step -- define your coordinate system, both (x,y,z) and (r,θ,φ). There are all sorts of different conventions. With that said, I agree with all your work in post #3 except for your definition of the vector ##\vec r ## . It would be correct to say ##\vec r ## = (r,θ,φ). I would only use an addition notation if it was made clear that none of the components could really be added (as we do in complex numbers with x+iy and in several other algebras). Once you have defined a unit vector, ##\hat r ## using θ and φ, there is no more use for θ,φ in specifying ##\vec r ##. So ##\vec r ## = r ##\hat r ##

PS I can't seem to get some of the symbols to work correctly, but I hope the meaning is clear.
 
Last edited:
  • Like
Likes Philosophaie
  • #28
From Post #3:
##r \hat{r} + \theta \hat{\theta} + \phi \hat{\phi} = \sqrt{(x^2 + y^2 + z^2)} \hat{r} + \arctan{(\frac{y}{x})} \hat{\theta} + \arccos{(\frac{z}{r})} \hat{\phi}##
Is this a true equation?
 
Last edited:
  • #29
Philosophaie said:
From Post #3:
##r \hat{r} + \theta \hat{\theta} + \phi \hat{\phi} = \sqrt{(x^2 + y^2 + z^2)} \hat{r} + \arctan{(\frac{y}{x})} \hat{\theta} + \arccos{(\frac{z}{r})} \hat{\phi}##
Is this a true equation?

Yes. But it is not the same vector as [itex] x * \hat x + y * \hat y + z * \hat z [/itex], which is what you stated in posts 1 and 3.
 
  • #30
What is different?
Does x,y,z not equal r,theta,phi in post #29?
 
Last edited:
  • #31
Philosophaie said:
What is different?
Does x,y,z not equal r,theta,phi in post #29?

Several of us have already explained to you several times what is wrong with your thinking. You need to go back and read the posts above carefully.
 
  • #32
No one explained to me that all the direction that I needed was give to me was in ##\hat r##. Thank you everyone trying to make me come to this conclusion.
 
  • #33
Philosophaie said:
No one explained to me that all the direction that I needed was give to me was in ##\hat r##. Thank you everyone trying to make me come to this conclusion.

Posts 19, 21, and 24 all told you that the position vector [itex] \vec r = r * \hat r [/itex] . I'm glad you finally arrived at the correct conclusion.
 
  • #34
Philosophaie said:
No one explained to me that all the direction that I needed was give to me was in ##\hat r##. Thank you everyone trying to make me come to this conclusion.
No, from the beginning everybody posting in this thread tried to tell you that you could not just assume that and help you figure it out for yourself. Then, finally, it was put explicitly in post #19.
 

FAQ: Convert from rectangular to Spherical Coordinates

What is the difference between rectangular and spherical coordinates?

Rectangular coordinates, also known as Cartesian coordinates, use three numbers (x, y, z) to represent a point in three-dimensional space. Spherical coordinates, on the other hand, use three numbers (ρ, θ, φ) to represent a point in three-dimensional space, where ρ is the distance from the origin, θ is the angle from the positive x-axis, and φ is the angle from the positive z-axis.

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

Converting from rectangular to spherical coordinates can be useful when working with certain mathematical equations or when trying to visualize a point in three-dimensional space. It can also be helpful when working with spherical objects or coordinates, such as the Earth or celestial bodies.

How do I convert from rectangular to spherical coordinates?

To convert from rectangular to spherical coordinates, you can use the following formulas: ρ = √(x² + y² + z²), θ = arctan(y/x), and φ = arccos(z/√(x² + y² + z²)). Keep in mind that these formulas may vary slightly depending on the specific system or convention being used.

Can I convert from spherical to rectangular coordinates?

Yes, you can also convert from spherical to rectangular coordinates using the following formulas: x = ρsinθcosφ, y = ρsinθsinφ, and z = ρcosθ. Again, these formulas may vary slightly depending on the specific system or convention being used.

Are there any limitations to using spherical coordinates?

While spherical coordinates can be useful in certain situations, they may not always be the most practical or efficient way to represent points in three-dimensional space. Additionally, some equations or systems may not be compatible with spherical coordinates, so it's important to understand when and how to use them appropriately.

Similar threads

Back
Top