Learn R Programming

stokes (version 1.1-1)

kform: k-forms

Description

Functionality for dealing with k-forms

Usage

kform(S)
as.kform(M,coeffs,lose=TRUE)
kform_basis(n, k)
kform_general(W,k,coeffs,lose=TRUE)
is.kform(x)
d(i)
# S3 method for kform
as.function(x,...)

Arguments

n

Dimension of the vector space V=R^nV=R^n

i

Integer

k

A k-form maps V^kV^k to R

W

Integer vector of dimensions

M,coeffs

Index matrix and coefficients for a k-form

S

Object of class spray

lose

Boolean, with default TRUE meaning to coerce a 0-form to a scalar and FALSE meaning to return the formal 0-form

x

Object of class kform

...

Further arguments, currently ignored

Value

All functions documented here return a kform object except as.function.kform(), which returns a function, and is.kform(), which returns a Boolean.

Details

A k-form is an alternating k-tensor. In the stokes package, k-forms are represented as sparse arrays (spray objects), but with a class of c("kform", "spray"). The constructor function kform() takes a spray object and returns a kform object: it ensures that rows of the index matrix are strictly nonnegative integers, have no repeated entries, and are strictly increasing. Function as.kform() is more user-friendly.

  • kform() is the constructor function. It takes a spray object and returns a kform.

  • as.kform() also returns a kform but is a bit more user-friendly than kform().

  • kform_basis() is a low-level helper function that returns a matrix whose rows constitute a basis for the vector space ^k(R^n)L^k(R^n) of k-forms.

  • kform_general() returns a kform object with terms that span the space of alternating tensors.

  • is.kform() returns TRUE if its argument is a kform object.

  • d() is an easily-typed synonym for as.kform()

Recall that a k-tensor is a multilinear map from V^k to the reals, where V=R^n is a vector space. A multilinear k-tensor T is alternating if it satisfies

T(v_1,…,v_i,…,v_j,…,v_k)= T(v_1,…,v_j,…,v_i,…,v_k) omitted; see latex

In the package, an object of class kform is an efficient representation of an alternating tensor.

Function kform_basis() is a low-level helper function that returns a matrix whose rows constitute a basis for the vector space ^k(R^n)L^k(R^n) of k-forms:

=_1 i_1 < < i_k n a_i_1… i_kdx_i_1 dx_i_komitted; see latex

and indeed we have:

a_i_1… i_k=(e_i_1,…,e_i_k) omitted; see latex

where e_j,1 j ke_j,1<=j<=k is a basis for V.

References

Hubbard and Hubbard; Spivak

See Also

ktensor,lose

Examples

Run this code
# NOT RUN {
as.kform(cbind(1:5,2:6),rnorm(5))
kform_general(1:4,2,coeffs=1:6)  # used in electromagnetism

K1 <- as.kform(cbind(1:5,2:6),rnorm(5))
K2 <- kform_general(5:8,2,1:6)
K1^K2  # or wedge(K1,K2)


f <- as.function(wedge(K1,K2))
E <- matrix(rnorm(32),8,4)
f(E) + f(E[,c(1,3,2,4)])  # should be zero by alternating property

options(stokes_symbolic_print = TRUE)
(d(5)+d(7)) ^ (d(2)^d(5) + 6*d(4)^d(7))
options(stokes_symbolic_print = FALSE)

# }

Run the code above in your browser using DataLab