Learn R Programming

stokes (version 1.1-3)

vector_cross_product: The Vector cross product

Description

The vector cross product is defined in elementary school for pairs of vectors in R^3R^3 as

uv=(u_2v_3-u_3v_2,u_2v_3-u_3v_2,u_2v_3-u_3v_2). u x v=(u_2 v_3 - u_3v_2, u_2 v_3 - u_3 v_2, u_2 v_3 - u_3 v_2).

However, this may easily be generalized to a product from n-1-tuples of vectors in R^3R^3. Vignette vector_cross_product gives a discussion.

Usage

vector_cross_product(M)

Value

Returns a vector

Arguments

M

Matrix with one more row than column; columns are interpreted as vectors

Author

Robin K. S. Hankin

Details

See vignette vector_cross_product

See Also

cross

Examples

Run this code

vector_cross_product(matrix(1:6,3,2))


M <- matrix(rnorm(30),6,5)
LHS <- hodge(as.1form(M[,1])^as.1form(M[,2])^as.1form(M[,3])^as.1form(M[,4])^as.1form(M[,5]))
RHS <- as.1form(vector_cross_product(M))
LHS-RHS  # zero to numerical precision

# Alternatively:
hodge(Reduce(`^`,sapply(seq_len(5),function(i){as.1form(M[,i])},simplify=FALSE)))

Run the code above in your browser using DataLab