Learn R Programming

globe (version 1.2-0)

cross:

Description

Computes the cross-product of two vectors in 3D.

Usage

cross(a, b)

Arguments

a,b
Numeric vectors of length 3.

Value

A vector of length 3 representing the cross product. If the input vectors have length greater than 3, only the first 3 elements will be used in this calculation.

Details

Computes the cross product of the two vectors.

See Also

dot

Examples

Run this code
   a <- c(1,0,0)
   b <- c(0,1,0)
   cross(a, b)

Run the code above in your browser using DataLab