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. ChangeBasis is thus complementary to ChangeCoordinates. 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⁡φ⁢ρ∧−sin⁡φ⁢φ∧
j∧=sin⁡φ⁢ρ∧+cos⁡φ⁢φ∧
From cartesian basis to spherical basis:
i∧=sin⁡θ⁢cos⁡φ⁢r∧+cos⁡θ⁢cos⁡φ⁢θ∧−sin⁡φ⁢φ∧
j∧=sin⁡θ⁢sin⁡φ⁢r∧+cos⁡θ⁢sin⁡φ⁢θ∧+cos⁡φ⁢φ∧
k∧=cos⁡θ⁢r∧−sin⁡θ⁢θ∧
From cylindrical basis to spherical basis:
ρ∧=sin⁡θ⁢r∧+cos⁡θ⁢θ∧
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 φ, 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
with⁡PhysicsVectors
&x,`+`,`.`,Assume,ChangeBasis,ChangeCoordinates,CompactDisplay,Component,Curl,DirectionalDiff,Divergence,Gradient,Identify,Laplacian,∇,Norm,ParametrizeCurve,ParametrizeSurface,ParametrizeVolume,Setup,Simplify,`^`,diff,int
Setup⁡mathematicalnotation=true
mathematicalnotation=true
A cartesian projected vector
R≔x⁢_i+y⁢_j+z⁢_k
R≔x⁢i∧+y⁢j∧+z⁢k∧
Vector R projected onto the cartesian basis.
ChangeBasis⁡R,1
x⁢i∧+y⁢j∧+z⁢k∧
Vector R projected onto the cylindrical basis.
ChangeBasis⁡R,2
x⁢cos⁡φ+y⁢sin⁡φ⁢ρ∧+cos⁡φ⁢y−sin⁡φ⁢x⁢φ∧+z⁢k∧
ChangeBasis⁡R,cylindrical,alsocomponents
z⁢k∧+ρ⁢ρ∧
Vector R projected onto the spherical basis: note also that automatic partial match of keywords
ChangeBasis⁡R,s
* Partial match of 's' against keyword 'spherical'
x⁢sin⁡θ⁢cos⁡φ+y⁢sin⁡θ⁢sin⁡φ+z⁢cos⁡θ⁢r∧+x⁢cos⁡φ⁢cos⁡θ+y⁢sin⁡φ⁢cos⁡θ−z⁢sin⁡θ⁢θ∧+cos⁡φ⁢y−sin⁡φ⁢x⁢φ∧
ChangeBasis⁡R,spherical,alsocomponents
r⁢r∧
See Also
convert,VectorCalculus, Physics, Physics conventions, Physics examples, Physics Updates, Tensors - a complete guide, Mini-Course Computer Algebra for Physicists, Physics/Vectors/ChangeCoordinates, Physics/Vectors/Identify, Physics/Vectors/operations, Physics[Vectors]
Download Help Document