Function reference · Linear algebra

cross

Computes the cross product of two three-dimensional vectors.

Both vectors must have three entries. The result is perpendicular to both.

Notation

cross(arg1, arg2)

Write it in an expression: nerdamer('cross([1,0,0],[0,1,0])'), or in the Playground.

nerdamer.cross

nerdamer.cross(...args: [a, b]): Expression | Vector

A method on the default import. Arguments can be strings, as in Notation.

import { cross }

import { cross } from 'nerdamer/structures';
cross(a: Vector, b: Vector): Vector

Import only this function, from nerdamer/structures.

Examples

The first two unit vectors give the third.

cross([1,0,0],[0,1,0])
// → [0, 0, 1]
Open in Playground

Symbolic entries.

cross([a,b,c],[x,y,z])
// → [b*z-c*y, c*x-a*z, a*y-b*x]
Open in Playground

← Back to Function reference