Learn R Programming

stokes (version 1.0-8)

contract: Contractions of \(k\)-forms

Description

A contraction is a natural linear map from \(k\)-forms to \(k-1\)-forms.

Usage

contract(K,v,lose=TRUE)
contract_elementary(o,v)

Arguments

K

A \(k\)-form

o

Integer-valued vector corresponding to one row of an index matrix

lose

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

v

A vector; in function contract(), if a matrix, interpret each column as a vector to contract with

Value

Returns an object of class kform.

Details

Given a \(k\)-form phi and a vector vv, the contraction \(\phi_\mathbf{v}\) of phi and vv is a k-1-form with

_v(v^1,…,v^k-1) = (v,v^1,…,v^k-1)

ommitted; see PDF

if k>1; we specify _v=(v)phi_v=phi(v) if k=1.

Function contract_elementary() is a low-level helper function that translates elementary \(k\)-forms with coefficient 1 (in the form of an integer vector corresponding to one row of an index matrix) into its contraction with \(\mathbf{v}\).

References

Steven H. Weintraub 2014. “Differential forms: theory and practice”, Elsevier (contractions defined in Definition 2.2.23 in chapter 2, page 77).

See Also

wedge,lose

Examples

Run this code
# NOT RUN {
contract(as.kform(1:5),1:8)
contract(as.kform(1),3)   # 0-form


## Now some verification:
o <- kform(spray(t(replicate(2, sample(9,5))), runif(2)))
V <- matrix(rnorm(45),ncol=5)
jj <- c(
   as.function(o)(V),
   as.function(contract(o,V[,1,drop=TRUE]))(V[,-1]), # scalar
   as.function(contract(o,V[,1:2]))(V[,-(1:2),drop=FALSE]),
   as.function(contract(o,V[,1:3]))(V[,-(1:3),drop=FALSE]),
   as.function(contract(o,V[,1:4]))(V[,-(1:4),drop=FALSE]),
   as.function(contract(o,V[,1:5],lose=FALSE))(V[,-(1:5),drop=FALSE])
)

max(jj) - min(jj) # zero to numerical precision
# }

Run the code above in your browser using DataLab