Convert 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
33 replies · 5K views
Philosophaie
Messages
456
Reaction score
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##
 
on Phys.org
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##
 
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.
 
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)=?##
 
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?
 
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.
 
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?
 
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?
 
##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?
 
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.
 
##\arctan{(\frac{y}{x})}## points in the ##\hat \theta## direction.
##\arccos{(\frac{z}{r})}## points in the ##\hat \phi## direction.
 
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.
 
Uncertain how to convert x,y,z to ##(\hat r, \hat \theta, \hat \theta)##. Can you give a hint?
 
Look above. Post #1.
 
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: 637
Last edited:
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})}##
 
So how do you emulate the radial component with ##\theta## and ##\phi## into one equation encompassing ##\hat r##, ##\hat \theta## and ##\hat \phi##?
 
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] ?
 
There is no direction for r.
 
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?
 
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   Reactions: Philosophaie
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:
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.
 
What is different?
Does x,y,z not equal r,theta,phi in post #29?
 
Last edited: