Provides functionality for working with tensors, alternating forms, wedge products, Stokes's theorem, and related concepts from the exterior calculus. Uses 'disordR' discipline (Hankin, 2022, <doi:10.48550/arXiv.2210.03856>). The canonical reference would be M. Spivak (1965, ISBN:0-8053-9021-9) "Calculus on Manifolds". To cite the package in publications please use Hankin (2022) <doi:10.48550/arXiv.2210.17008>.

Details

The DESCRIPTION file: This package was not yet installed at build time.
Index: This package was not yet installed at build time.

Generally in the package, arguments that are \(k\)-forms are denoted K, \(k\)-tensors by U, and spray objects by S. Multilinear maps (which may be either \(k\)-forms or \(k\)-tensors) are denoted by M.

Author

Robin K. S. Hankin [aut, cre] (<https://orcid.org/0000-0001-5982-0415>)

Maintainer: Robin K. S. Hankin <hankin.robin@gmail.com>

References

See also

Examples

## Some k-tensors:
U1 <- as.ktensor(matrix(1:15,5,3))
U2 <- as.ktensor(cbind(1:3,2:4),1:3)

## Coerce a tensor to functional form, here mapping V^3  -> R (here V=R^15):
as.function(U1)(matrix(rnorm(45),15,3))
#> [1] -1.657814

## Tensor product is tensorprod() or %X%:
U1 %X% U2
#> A linear map from V^5 to R with V=R^15:
#>                  val
#>  1  6 11 1 2  =    1
#>  2  7 12 1 2  =    1
#>  4  9 14 3 4  =    3
#>  1  6 11 3 4  =    3
#>  3  8 13 3 4  =    3
#>  5 10 15 3 4  =    3
#>  3  8 13 1 2  =    1
#>  1  6 11 2 3  =    2
#>  2  7 12 3 4  =    3
#>  5 10 15 2 3  =    2
#>  4  9 14 2 3  =    2
#>  3  8 13 2 3  =    2
#>  2  7 12 2 3  =    2
#>  5 10 15 1 2  =    1
#>  4  9 14 1 2  =    1


## A k-form is an alternating k-tensor:
K1 <- as.kform(cbind(1:5,2:6),rnorm(5))
K2 <- kform_general(3:6,2,1:6)
K3 <- rform(9,3,9,runif(9))

## The distributive law is true

(K1 + K2) ^ K3 == K1 ^ K3 + K2 ^ K3 # TRUE to numerical precision
#> [1] FALSE

## Wedge product is associative (non-trivial):
(K1 ^ K2) ^ K3
#> An alternating linear map from V^7 to R with V=R^9:
#>                           val
#>  1 2 3 4 5 6 9  =  -0.4304560
#>  2 3 4 5 6 7 8  =   1.2361588
#>  2 3 4 5 6 8 9  =   0.4861741
#>  1 2 3 4 6 8 9  =   0.1438165
#>  1 2 4 5 6 8 9  =   0.4314494
#>  1 2 3 4 5 6 7  =  -2.9728270
#>  1 2 3 4 6 7 8  =  -4.0184170
#>  1 2 3 5 6 7 8  =  -3.9444890
#>  1 2 4 5 6 7 8  =   1.0970143
#>  1 2 3 5 6 8 9  =   0.2876329
#>  1 2 3 4 5 6 8  =  -6.0991398
#>  1 2 3 4 5 7 8  =  -2.3379159
K1 ^ (K2 ^ K3)
#> An alternating linear map from V^7 to R with V=R^9:
#>                           val
#>  1 2 3 4 5 7 8  =  -2.3379159
#>  1 2 3 4 5 6 8  =  -6.0991398
#>  1 2 3 5 6 7 8  =  -3.9444890
#>  1 2 3 4 6 8 9  =   0.1438165
#>  2 3 4 5 6 7 8  =   1.2361588
#>  1 2 4 5 6 7 8  =   1.0970143
#>  1 2 3 5 6 8 9  =   0.2876329
#>  2 3 4 5 6 8 9  =   0.4861741
#>  1 2 3 4 5 6 7  =  -2.9728270
#>  1 2 4 5 6 8 9  =   0.4314494
#>  1 2 3 4 6 7 8  =  -4.0184170
#>  1 2 3 4 5 6 9  =  -0.4304560


## k-forms can be coerced to a function and wedge product:
f <- as.function(K1 ^ K2 ^ K3)

## E is a a random point in V^k:
E <- matrix(rnorm(63),9,7)

## f() is alternating:
f(E)
#> [1] 22.86506
f(E[,7:1])
#> [1] -22.86506



## The package blurs the distinction between symbolic and numeric computing:
dx <- as.kform(1)
dy <- as.kform(2)
dz <- as.kform(3)

dx ^ dy ^ dz
#> An alternating linear map from V^3 to R with V=R^3:
#>            val
#>  1 2 3  =    1

K3 ^ dx ^ dy ^ dz
#> An alternating linear map from V^6 to R with V=R^9:
#>                         val
#>  1 2 3 6 8 9  =   0.2068019
#>  1 2 3 4 7 8  =   0.2629099
#>  1 2 3 4 6 8  =   0.7927355
#>  1 2 3 4 5 8  =  -1.7962075
#>  1 2 3 5 6 9  =  -0.6189772