Mapping a Vector to Various Coordinate Systems 

Note it is easy to change to cylindrical or spherical coordinates and then back to cartesian coordinates, even without explicitly defining the components of v.  This is accomplished using the MapToBasis command as shown below. 

 

> v := unapply(MapToBasis(v(x, y, z), spherical), rho, phi, theta); 1
 

(Typesetting:-mprintslash)([v := proc (rho, phi, theta) options operator, arrow; Vector[Column]( 1..3,[ ... ] ) end proc], [proc (rho, phi, theta) options operator, arrow; Vector[Column]( 1..3,[ ... ]... 

 

It doesn't look like anything was accomplished, but if we now look at the vector v(rho, phi, theta) we see that Maple has indeed mapped the vector to spherical coordinates. 

 

> v(rho, phi, theta); 1
 

(Typesetting:-mprintslash)([Vector[column]([[(vx(x, y, z)^2+vy(x, y, z)^2+vz(x, y, z)^2)^(1/2)], [arctan((vy(x, y, z)^2+vx(x, y, z)^2)^(1/2), vz(x, y, z))], [arctan(vy(x, y, z), vx(x, y, z))]], [
(Typesetting:-mprintslash)([Vector[column]([[(vx(x, y, z)^2+vy(x, y, z)^2+vz(x, y, z)^2)^(1/2)], [arctan((vy(x, y, z)^2+vx(x, y, z)^2)^(1/2), vz(x, y, z))], [arctan(vy(x, y, z), vx(x, y, z))]], [
(Typesetting:-mprintslash)([Vector[column]([[(vx(x, y, z)^2+vy(x, y, z)^2+vz(x, y, z)^2)^(1/2)], [arctan((vy(x, y, z)^2+vx(x, y, z)^2)^(1/2), vz(x, y, z))], [arctan(vy(x, y, z), vx(x, y, z))]], [
 

 

For the sake of completion, I show a transformation from spherical coordinates to cylindrical coordinates, followed by a transformation back to cartesian coordinates. 

 

> v := unapply(MapToBasis(v(x, y, z), cylindrical), rho, phi, theta); 1
 

(Typesetting:-mprintslash)([v := proc (rho, phi, theta) options operator, arrow; Vector[Column]( 1..3,[ ... ] ) end proc], [proc (rho, phi, theta) options operator, arrow; Vector[Column]( 1..3,[ ... ]... 

> v(rho, phi, theta); 1
 

(Typesetting:-mprintslash)([Vector[column]([[(vy(x, y, z)^2+vx(x, y, z)^2)^(1/2)], [arctan(vy(x, y, z), vx(x, y, z))], [vz(x, y, z)]], [
(Typesetting:-mprintslash)([Vector[column]([[(vy(x, y, z)^2+vx(x, y, z)^2)^(1/2)], [arctan(vy(x, y, z), vx(x, y, z))], [vz(x, y, z)]], [
 

> v := unapply(MapToBasis(v(x, y, z)), x, y, z); 1
 

(Typesetting:-mprintslash)([v := proc (x, y, z) options operator, arrow; rtable(1 .. 3, {(1) = vx(x, y, z), (2) = vy(x, y, z), (3) = vz(x, y, z)}, datatype = anything, subtype = Vector[column], storag...
(Typesetting:-mprintslash)([v := proc (x, y, z) options operator, arrow; rtable(1 .. 3, {(1) = vx(x, y, z), (2) = vy(x, y, z), (3) = vz(x, y, z)}, datatype = anything, subtype = Vector[column], storag...
(Typesetting:-mprintslash)([v := proc (x, y, z) options operator, arrow; rtable(1 .. 3, {(1) = vx(x, y, z), (2) = vy(x, y, z), (3) = vz(x, y, z)}, datatype = anything, subtype = Vector[column], storag...
(Typesetting:-mprintslash)([v := proc (x, y, z) options operator, arrow; rtable(1 .. 3, {(1) = vx(x, y, z), (2) = vy(x, y, z), (3) = vz(x, y, z)}, datatype = anything, subtype = Vector[column], storag...
 

> v(x, y, z); 1
 

(Typesetting:-mprintslash)([Vector[column]([[vx(x, y, z)], [vy(x, y, z)], [vz(x, y, z)]], [ 

 

Of course, it is also simple to map a vector that is completely defined in terms of numerical values.  This is seen below. 

 

> delta; 1
 

(Typesetting:-mprintslash)([Vector[column]([[1], [1], [1]], [ 

> delta := MapToBasis(delta, cylindrical); 1
 

(Typesetting:-mprintslash)([delta := Vector[column]([[2^(1/2)], [1/4*Pi], [1]], [