Question: MapToBasis/ChangeBasis -- Spherical to Cartesian

Hello,

When I create a vector in spherical coordinates and map it to cartesian coordinates with Physics[Vectors] package as follows,

restart:with(Physics[Vectors]):
q_:=a _r + b _theta + c _phi
ChangeBasis(q_,cartesian)

I get the answer:

(a*cos(phi)*sin(theta)+b*cos(phi)*cos(theta)-c*sin(phi)) i + (a*sin(theta)*sin(phi)+b*cos(theta)*sin(phi)+c*cos(phi)) j + (-b*sin(theta)+a*cos(theta)) k

which is what I would expect.

But if I try to do that with VectorCalculus package as follows,

q := SetCoordinates(<a, b, c>, spherical)
MapToBasis(q, cartesian)

This gives 

(a*sin(b)*cos(c)) ex + (a*sin(b)*sin(c)) ey + (a*cos(b)) ez

I am confused about this!

The SetCoordinates(<a, b, c>, spherical) command outputs

q:=(a) er  + (b) ephi + (c) etheta

here, a,b, and c are  depicted as the components of the vector q in spherical coordinates, but when I map to cartesian coordinates, a,b, and c are treated as if they were the coordinates in spherical coordinates rather than components-- unlike ChangeBasis in Physics[Vectors] package.

Why are these two different?

Please Wait...