Random \(k\)-form objects and \(k\)-tensors, intended as quick “get you going” examples

rform(terms=9,k=3,n=7,coeffs,ensure=TRUE)
rtensor(terms=9,k=3,n=7,coeffs)

Arguments

terms

Number of distinct terms

k,n

A \(k\)-form maps \(V^k\) to \(\mathbb{R}\), where \(V=\mathbb{R}^n\)

coeffs

The coefficients of the form; if missing use seq_len(terms)

ensure

Boolean with default TRUE meaning to ensure that the dovs() of the returned value is in fact equal to n. If FALSE, sometimes the dovs() is strictly less than n because of random sampling

Details

Random \(k\)-form objects and \(k\)-tensors, of moderate complexity.

Note that argument terms is an upper bound, as the index matrix might contain repeats which are combined.

Value

All functions documented here return an object of class kform or ktensor.

Author

Robin K. S. Hankin

Examples


(a <- rform())
#> An alternating linear map from V^3 to R with V=R^7:
#>            val
#>  1 4 7  =    6
#>  3 5 6  =   -8
#>  2 6 7  =    3
#>  2 3 5  =    2
#>  2 3 7  =   -2
#>  1 3 4  =    4
(b <- rform())
#> An alternating linear map from V^3 to R with V=R^7:
#>            val
#>  4 5 7  =    9
#>  1 2 6  =   -6
#>  1 3 6  =    4
#>  1 5 7  =    5
#>  1 6 7  =    4
#>  2 4 6  =    7
a ^ b
#> An alternating linear map from V^6 to R with V=R^7:
#>                  val
#>  1 2 3 5 6 7  =   -8

a
#> An alternating linear map from V^3 to R with V=R^7:
#>            val
#>  1 4 7  =    6
#>  3 5 6  =   -8
#>  2 6 7  =    3
#>  2 3 5  =    2
#>  2 3 7  =   -2
#>  1 3 4  =    4
a ^ dx
#> An alternating linear map from V^4 to R with V=R^7:
#>              val
#>  1 2 3 5  =   -2
#>  1 2 3 7  =    2
#>  1 2 6 7  =   -3
#>  1 3 5 6  =    8
a ^ dx ^ dy
#> An alternating linear map from V^5 to R with V=R^6:
#>                val
#>  1 2 3 5 6  =   -8

(x <- rtensor())
#> A linear map from V^3 to R with V=R^7:
#>            val
#>  1 4 7  =    8
#>  5 2 2  =   15
#>  5 1 5  =    5
#>  7 3 7  =    4
#>  3 1 7  =    2
#>  3 2 7  =    7
#>  5 1 4  =    3
#>  7 2 5  =    1
x %X% x
#> A linear map from V^6 to R with V=R^7:
#>                  val
#>  7 2 5 7 2 5  =    1
#>  3 2 7 7 2 5  =    7
#>  3 1 7 7 3 7  =    8
#>  5 1 5 7 3 7  =   20
#>  7 2 5 3 1 7  =    2
#>  5 2 2 7 3 7  =   60
#>  3 1 7 5 1 4  =    6
#>  7 2 5 5 1 5  =    5
#>  5 2 2 5 1 5  =   75
#>  5 2 2 3 2 7  =  105
#>  7 3 7 7 3 7  =   16
#>  5 2 2 5 2 2  =  225
#>  3 2 7 5 1 4  =   21
#>  5 2 2 1 4 7  =  120
#>  1 4 7 5 2 2  =  120
#>  5 1 4 7 2 5  =    3
#>  1 4 7 5 1 5  =   40
#>  3 1 7 7 2 5  =    2
#>  7 2 5 5 2 2  =   15
#>  5 1 5 1 4 7  =   40
#>  5 1 5 5 1 5  =   25
#>  7 2 5 1 4 7  =    8
#>  5 1 4 7 3 7  =   12
#>  3 1 7 1 4 7  =   16
#>  5 1 4 5 1 5  =   15
#>  3 2 7 5 1 5  =   35
#>  3 2 7 3 1 7  =   14
#>  5 1 5 5 2 2  =   75
#>  3 2 7 7 3 7  =   28
#>  5 1 4 5 2 2  =   45
#>  3 2 7 5 2 2  =  105
#>  5 1 5 3 2 7  =   35
#>  3 1 7 5 1 5  =   10
#>  7 3 7 5 2 2  =   60
#>  3 2 7 3 2 7  =   49
#>  3 1 7 5 2 2  =   30
#>  5 2 2 3 1 7  =   30
#>  5 1 5 3 1 7  =   10
#>  7 3 7 3 1 7  =    8
#>  7 3 7 3 2 7  =   28
#>  3 2 7 1 4 7  =   56
#>  5 1 5 5 1 4  =   15
#>  3 1 7 3 1 7  =    4
#>  5 1 4 3 1 7  =    6
#>  1 4 7 3 2 7  =   56
#>  3 1 7 3 2 7  =   14
#>  1 4 7 7 3 7  =   32
#>  7 2 5 7 3 7  =    4
#>  5 1 4 3 2 7  =   21
#>  7 3 7 1 4 7  =   32
#>  5 1 4 1 4 7  =   24
#>  1 4 7 3 1 7  =   16
#>  7 2 5 3 2 7  =    7
#>  1 4 7 5 1 4  =   24
#>  7 3 7 7 2 5  =    4
#>  5 2 2 5 1 4  =   45
#>  7 3 7 5 1 4  =   12
#>  5 1 4 5 1 4  =    9
#>  7 2 5 5 1 4  =    3
#>  1 4 7 7 2 5  =    8
#>  7 3 7 5 1 5  =   20
#>  5 2 2 7 2 5  =   15
#>  1 4 7 1 4 7  =   64
#>  5 1 5 7 2 5  =    5