cross
Computes the cross product of two three-dimensional vectors.
Concrete Vector operands must each contain exactly three elements. The result is a Vector perpendicular to the two input vectors. Symbolic non-vector operands can remain as an unevaluated cross call.
Examples
These examples use Nerdamer Notation.
Compute the cross product of the first two standard basis vectors.
cross([1,0,0],[0,1,0]) // → [0, 0, 1]
Compute a cross product with symbolic components.
cross([a,b,c],[x,y,z])Interfaces
The same operation is available through the interfaces below.
Nerdamer Notation
Use this form inside input passed to nerdamer(...).
cross(arg1, arg2)
nerdamer.cross
Call the operation through the default nerdamer import.
nerdamer.cross(a: ParserEntity, b: ParserEntity): Expression | Vector
Parameters
| Name | Type | Description |
|---|---|---|
a | ParserEntity | First Vector, or a symbolic Expression operand. |
b | ParserEntity | Second Vector, or a symbolic Expression operand. |
Returns
Expression | Vector — The Vector cross product, or an unevaluated `cross(a, b)` Expression when both operands are Expressions.
Direct JavaScript / TypeScript API
Import the operation directly from its package entry point.
import { cross } from 'nerdamer/structures';
cross(a: ParserEntity, b: ParserEntity): Expression | Vector
Parameters
| Name | Type | Description |
|---|---|---|
a | ParserEntity | First Vector, or a symbolic Expression operand. |
b | ParserEntity | Second Vector, or a symbolic Expression operand. |
Returns
Expression | Vector — The Vector cross product, or an unevaluated `cross(a, b)` Expression when both operands are Expressions.
