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] ] ] |
|
| A polar vector with the angle in degrees. | Simplify[ ComponentForm[ PolarVector[2, Quantity[30, 'deg']] ] ] |
|
| The sum of two vectors in basis form. | Simplify[ ComponentForm[ BaseVector[-4, 2] + BaseVector[2, -3] ] ] |
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' ] ] |
|
Simplify[ ComponentForm[ PolarVector[1, 0], Format=>'BaseVector' ] ] |
||
ComponentForm[ expr, Format=>'CartesianVector' ] |
Simplify[ ComponentForm[ BaseVector[3, 4], Format=>'CartesianVector' ] ] |
Details
- Without
Simplify, the command is not calculated: in a script,ComponentForm[ PolarVector[2, 1/4 Pi] ]stays unevaluated. - An unknown value for
Formatis ignored without an error. - An expression without vectors, such as
ComponentForm[ 5 ], is left unevaluated.
See also: PolarForm, Magnitude, BaseVector, PolarVector