 ChangeBasis - Maple Help

Home : Support : Online Help : Physics : Vectors : ChangeBasis

Physics[Vectors][ChangeBasis] - change the projection basis and optionally also the coordinates used in the components of the vector expression Calling Sequence ChangeBasis(A, newbasis) ChangeBasis(A, newbasis, alsocomponents) Parameters

 A - any algebraic expression newbasis - one of the bases identifiers {1, 2, 3}, or one of the bases keywords {cartesian, cylindrical, spherical} alsocomponents - optional, to indicate that the components of the vector expression too should be expressed in terms of the natural coordinates of newbasis Description

 • ChangeBasis changes the projection basis (unit vectors) of a given vector function to the projection basis indicated newbasis. Optionally, when the argument alsocomponents is given, the components of the vector are also rewritten in terms of the natural coordinates related to newbasis. For the conventions used in the Physics[Vectors] subpackage to represent vector functions, see conventions.
 • The %ChangeBasis is the inert form of ChangeBasis, that is: it represents the same mathematical operation while holding the operation unperformed. To activate the operation use value.
 – If $A$ is not a vector function, then an error message is returned.
 – If $A$ is a non-projected vector, then ChangeBasis returns unevaluated.
 – Otherwise, the projection basis is changed according to:
 – From cartesian basis to cylindrical basis:
 > _i = (cos(phi) * _rho - sin(phi) * _phi);
 ${\mathrm{_i}}{=}{\mathrm{cos}}{}\left({\mathrm{\phi }}\right){}{\mathrm{_ρ}}{-}{\mathrm{sin}}{}\left({\mathrm{\phi }}\right){}{\mathrm{_φ}}$ (1)
 > _j = (sin(phi) *_rho + cos(phi) * _phi);
 ${\mathrm{_j}}{=}{\mathrm{sin}}{}\left({\mathrm{\phi }}\right){}{\mathrm{_ρ}}{+}{\mathrm{cos}}{}\left({\mathrm{\phi }}\right){}{\mathrm{_φ}}$ (2)
 – From cartesian basis to spherical basis:
 > _i = (sin(theta)*cos(phi)*_r + cos(theta)*cos(phi)*_theta -sin(phi)*_phi);
 ${\mathrm{_i}}{=}{\mathrm{sin}}{}\left({\mathrm{\theta }}\right){}{\mathrm{cos}}{}\left({\mathrm{\phi }}\right){}{\mathrm{_r}}{+}{\mathrm{cos}}{}\left({\mathrm{\theta }}\right){}{\mathrm{cos}}{}\left({\mathrm{\phi }}\right){}{\mathrm{_θ}}{-}{\mathrm{sin}}{}\left({\mathrm{\phi }}\right){}{\mathrm{_φ}}$ (3)
 > _j = (sin(theta)*sin(phi)*_r + cos(theta)*sin(phi)*_theta + cos(phi)*_phi);
 ${\mathrm{_j}}{=}{\mathrm{sin}}{}\left({\mathrm{\theta }}\right){}{\mathrm{sin}}{}\left({\mathrm{\phi }}\right){}{\mathrm{_r}}{+}{\mathrm{cos}}{}\left({\mathrm{\theta }}\right){}{\mathrm{sin}}{}\left({\mathrm{\phi }}\right){}{\mathrm{_θ}}{+}{\mathrm{cos}}{}\left({\mathrm{\phi }}\right){}{\mathrm{_φ}}$ (4)
 > _k = (cos(theta)*_r - sin(theta)*_theta);
 ${\mathrm{_k}}{=}{\mathrm{cos}}{}\left({\mathrm{\theta }}\right){}{\mathrm{_r}}{-}{\mathrm{sin}}{}\left({\mathrm{\theta }}\right){}{\mathrm{_θ}}$ (5)
 – From cylindrical basis to spherical basis:
 > _rho = (sin(theta)*_r + cos(theta)*_theta);
 ${\mathrm{_ρ}}{=}{\mathrm{sin}}{}\left({\mathrm{\theta }}\right){}{\mathrm{_r}}{+}{\mathrm{cos}}{}\left({\mathrm{\theta }}\right){}{\mathrm{_θ}}$ (6)
 > _k   = (cos(theta)*_r - sin(theta)*_theta);
 ${\mathrm{_k}}{=}{\mathrm{cos}}{}\left({\mathrm{\theta }}\right){}{\mathrm{_r}}{-}{\mathrm{sin}}{}\left({\mathrm{\theta }}\right){}{\mathrm{_θ}}$ (7)
 • When changing the basis, some extra factors depending on the coordinates are introduced. These factors are always expressed in the "upper" coordinate's system; i.e., the transformation from cartesian to cylindrical (from 1 to 2) will introduce factors depending on $\mathrm{\phi }$, and so on, as shown in the examples below.
 • Note that, by default, only the projection basis is changed, not the coefficients of the unit vectors (components). To additionally change the components of the vector, re-expressing them in terms of the natural coordinates of the indicated newbasis, use the optional argument alsocomponents. Examples

 > $\mathrm{with}\left(\mathrm{Physics}\left[\mathrm{Vectors}\right]\right)$
 $\left[{\mathrm{&x}}{,}{\mathrm{+}}{,}{\mathrm{.}}{,}{\mathrm{ChangeBasis}}{,}{\mathrm{ChangeCoordinates}}{,}{\mathrm{Component}}{,}{\mathrm{Curl}}{,}{\mathrm{DirectionalDiff}}{,}{\mathrm{Divergence}}{,}{\mathrm{Gradient}}{,}{\mathrm{Identify}}{,}{\mathrm{Laplacian}}{,}{\nabla }{,}{\mathrm{Norm}}{,}{\mathrm{Setup}}{,}{\mathrm{diff}}\right]$ (8)
 > $\mathrm{Setup}\left(\mathrm{mathematicalnotation}=\mathrm{true}\right)$
 $\left[{\mathrm{mathematicalnotation}}{=}{\mathrm{true}}\right]$ (9)

A cartesian projected vector

 > $R≔x\mathrm{_i}+y\mathrm{_j}+z\mathrm{_k}$
 ${R}{≔}{x}{}\stackrel{{\wedge }}{{i}}{+}{y}{}\stackrel{{\wedge }}{{j}}{+}{z}{}\stackrel{{\wedge }}{{k}}$ (10)

Vector R projected onto the cartesian basis.

 > $\mathrm{ChangeBasis}\left(R,1\right)$
 ${x}{}\stackrel{{\wedge }}{{i}}{+}{y}{}\stackrel{{\wedge }}{{j}}{+}{z}{}\stackrel{{\wedge }}{{k}}$ (11)

Vector R projected onto the cylindrical basis.

 > $\mathrm{ChangeBasis}\left(R,2\right)$
 $\left({x}{}{\mathrm{cos}}{}\left({\mathrm{\phi }}\right){+}{y}{}{\mathrm{sin}}{}\left({\mathrm{\phi }}\right)\right){}\stackrel{{\wedge }}{{\mathrm{\rho }}}{+}\left({\mathrm{cos}}{}\left({\mathrm{\phi }}\right){}{y}{-}{\mathrm{sin}}{}\left({\mathrm{\phi }}\right){}{x}\right){}\stackrel{{\wedge }}{{\mathrm{\phi }}}{+}{z}{}\stackrel{{\wedge }}{{k}}$ (12)
 > $\mathrm{ChangeBasis}\left(R,\mathrm{cylindrical},\mathrm{alsocomponents}\right)$
 ${z}{}\stackrel{{\wedge }}{{k}}{+}{\mathrm{\rho }}{}\stackrel{{\wedge }}{{\mathrm{\rho }}}$ (13)

Vector R projected onto the spherical basis: note also that automatic partial match of keywords

 > $\mathrm{ChangeBasis}\left(R,s\right)$
 $\mathrm{* Partial match of \text{'}}{}s{}\mathrm{\text{'} against keyword \text{'}}{}\mathrm{spherical}{}\text{'}$
 $\left({x}{}{\mathrm{sin}}{}\left({\mathrm{\theta }}\right){}{\mathrm{cos}}{}\left({\mathrm{\phi }}\right){+}{y}{}{\mathrm{sin}}{}\left({\mathrm{\theta }}\right){}{\mathrm{sin}}{}\left({\mathrm{\phi }}\right){+}{z}{}{\mathrm{cos}}{}\left({\mathrm{\theta }}\right)\right){}\stackrel{{\wedge }}{{r}}{+}\left({x}{}{\mathrm{cos}}{}\left({\mathrm{\phi }}\right){}{\mathrm{cos}}{}\left({\mathrm{\theta }}\right){+}{y}{}{\mathrm{sin}}{}\left({\mathrm{\phi }}\right){}{\mathrm{cos}}{}\left({\mathrm{\theta }}\right){-}{z}{}{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)\right){}\stackrel{{\wedge }}{{\mathrm{\theta }}}{+}\left({\mathrm{cos}}{}\left({\mathrm{\phi }}\right){}{y}{-}{\mathrm{sin}}{}\left({\mathrm{\phi }}\right){}{x}\right){}\stackrel{{\wedge }}{{\mathrm{\phi }}}$ (14)
 > $\mathrm{ChangeBasis}\left(R,\mathrm{spherical},\mathrm{alsocomponents}\right)$
 ${r}{}\stackrel{{\wedge }}{{r}}$ (15)
 > See Also