Is there an easy way to transform unit vectors from spherical to Cartesian coordinates? [duplicate]

This question already has an answer here:

How to change coordinates of a differential operator?

2 answers

Is there a built-in function on Mathematica that will transform unit vectors from one coordinate system to another? I have a vector expressed in spherical coordinates, and I would like to find the Cartesian components of the vector, but still express those Cartesian components using (r,θ,ϕ)(r,\theta,\phi). The transformation I am trying to generate is listed below:


The above uses the physics convention where θ\theta is the polar angle. So basically I would like Mathematica to automatically generate a matrix which looks like this:


If I act this matrix on my vector (expressed in spherical coordinates) I will get what I want. Of course I could just type this matrix in myself, but that is not very elegant… The JacobianMatrix command is close, but not quite what I am looking for.



1 Answer


“Spherical” -> “Cartesian”,
{1, θ, φ}
] // MatrixForm



Thanks for the fast reply! Your solution is close, but not quite right — the third column is not quite right.
– Charlie
Feb 25 ’15 at 16:21



I set r = 1 just to conform to your example. You can just use r.
– Taiki
Feb 25 ’15 at 16:22



Sorry. Now the third column is right.
– Taiki
Feb 25 ’15 at 19:05



Taiki,Thank you very much. This works great. I can even put {r,[Theta],[CurlyPhi]} in there and it works. -Charlie
– Charlie
Feb 25 ’15 at 19:49