ComponentForm

ComponentForm

ComponentForm[ expr ] converts the vectors in an expression to component form.

Usages

ComponentForm[ expr ]

ComponentForm[ expr ] writes the vectors in expr in component form and adds them where possible. A polar vector or column vector becomes a column vector; a vector in basis form stays in basis form. In a script, wrap the command in Simplify.

Example in rendered
A polar vector. Simplify[ ComponentForm[ PolarVector[2, 1/4 Pi] ] ] (22)\begin{pmatrix}\sqrt{2}\\\sqrt{2}\end{pmatrix}
A polar vector with the angle in degrees. Simplify[ ComponentForm[ PolarVector[2, Quantity[30, 'deg']] ] ] (31)\begin{pmatrix}\sqrt{3}\\1\end{pmatrix}
The sum of two vectors in basis form. Simplify[ ComponentForm[ BaseVector[-4, 2] + BaseVector[2, -3] ] ] -2i−j\text{-}2\mathbf{i}-\mathbf{j}
Options

Format

The form of the result: 'BaseVector' for basis form or 'CartesianVector' for a column vector.

Syntax Example rendered
ComponentForm[ expr, Format=>'BaseVector' ] Simplify[ ComponentForm[ CartesianVector[3, 4], Format=>'BaseVector' ] ] 3i+4j3\mathbf{i}+4\mathbf{j}
Simplify[ ComponentForm[ PolarVector[1, 0], Format=>'BaseVector' ] ] i\mathbf{i}
ComponentForm[ expr, Format=>'CartesianVector' ] Simplify[ ComponentForm[ BaseVector[3, 4], Format=>'CartesianVector' ] ] (34)\begin{pmatrix}3\\4\end{pmatrix}
Details
  • Without Simplify, the command is not calculated: in a script, ComponentForm[ PolarVector[2, 1/4 Pi] ] stays unevaluated.
  • An unknown value for Format is ignored without an error.
  • An expression without vectors, such as ComponentForm[ 5 ], is left unevaluated.

See also: PolarForm, Magnitude, BaseVector, PolarVector