vector_cross_product: The Vector cross product

vector_cross_productR Documentation

The Vector cross product

Description

\loadmathjax

The vector cross product \mjeqn\mathbfu\times\mathbfvomitted for \mjeqn\mathbfu,\mathbfu\in\mathbbR^3omitted is defined in elementary school as

\mjdeqn \mathbf

u\times\mathbfv=\left(u_2v_3-u_3v_2,u_2v_3-u_3v_2,u_2v_3-u_3v_2\right). 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).

Function vcp3() is a convenience wrapper for this. However, the vector cross product may easily be generalized to a product of \mjseqnn-1-tuples of vectors in \mjeqn\mathbbR^3R^n, given by package function vector_cross_product().

Vignette vector_cross_product, supplied with the package, gives an extensive discussion of vector cross products, including formal definitions and verification of identities.

Usage

vector_cross_product(M)
vcp3(u,v)

Arguments

M

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

u,v

Vectors of length 3, representing vectors in \mjeqn\mathbbR^3R^3

Details

See vignette vector_cross_product

Value

Returns a vector

Author(s)

Robin K. S. Hankin

See Also

cross

Examples


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)))

stokes documentation built on Aug. 19, 2023, 1:07 a.m.