Learn R Programming

linkR (version 1.1.1)

cprod: Computes the cross product of two vectors

Description

Returns the cross product of two vectors using either the right-hand or left-hand convention.

Usage

cprod(u, v, h = "right")

Arguments

u
a vector of length 3
v
a vector of length 3
h
whether the right-hand, "right", or left-hand, "left", convention is to be used. The right-hand convention is default.

Value

Details

The cross product vector is a vector orthogonal to the two input vectors.

Examples

Run this code

## DEFINE TWO 3D VECTORS
u <- c(1, 0, 0)
v <- c(0, 1, 0)

## FIND THE CROSS PRODUCT
cprod(u, v)

Run the code above in your browser using DataLab