Learn R Programming

stokes (version 1.0-8)

transform: Linear transforms of \(k\)-forms

Description

Given a \(k\)-form, express it in terms of linear combinations of the dx_idx_i

Usage

transform(K,M)
stretch(K,d)

Arguments

K

Object of class kform

M

Matrix of transformation

d

Numeric vector representing the diagonal elements of a diagonal matrix

Value

The functions documented here return an object of class kform.

Details

Suppose we are given a two-form

=_i < ja_ijdx_i dx_jomitted: see latex

and relationships

dx_i=_rM_irdy_romitted: see latex

then we would have

= _i < j a_ij(_rM_irdy_r)(_rM_jrdy_r). omitted: see latex

The general situation would be a \(k\)-form where we would have

=_i_1 < < i_ka_i_1… i_kdx_i_1 dx_i_komitted: see latex

giving

= _i_1 < < i_k[ a_i_1,…, i_k(_rM_i_1rdy_r)(_rM_i_krdy_r)]. omitted: see latex

The transform() function does all this but it is slow. I am not 100% sure that there isn't a much more efficient way to do such a transformation. There are a few tests in tests/testthat and a discussion in the stokes vignette.

Function stretch() carries out the same operation but for \(M\) a diagonal matrix. It is much faster than transform().

References

S. H. Weintraub 2019. Differential forms: theory and practice. Elsevier. (Chapter 3)

See Also

wedge

Examples

Run this code
# NOT RUN {
# Example in the text:
K <- as.kform(matrix(c(1,1,2,3),2,2),c(1,5))
M <- matrix(1:9,3,3)
transform(K,M)

# Demonstrate that the result can be complicated:
M <- matrix(rnorm(25),5,5)
transform(as.kform(1:2),M)

# Numerical verification:
o <- rform(terms=2,n=5)

o2 <- transform(transform(o,M),solve(M))
max(abs(value(o-o2))) # zero to numerical precision

# Following should be zero:
transform(as.kform(1),M)-as.kform(matrix(1:5),c(crossprod(M,c(1,rep(0,4)))))

# Following should be TRUE:
issmall(transform(o,crossprod(matrix(rnorm(10),2,5))))

# Some stretch() use-cases:

p <- rform()
p
stretch(p,seq_len(7))
stretch(p,c(1,0,1,1,1))   # kills dimension 2

# }

Run the code above in your browser using DataLab