Learn R Programming

stokes (version 1.2-3)

rform: Random kforms and ktensors

Description

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

Usage

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

Value

All functions documented here return an object of class kform or

ktensor.

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

Author

Robin K. S. Hankin

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.

Examples

Run this code

(a <- rform())
(b <- rform())
a ^ b

a
a ^ dx
a ^ dx ^ dy

(x <- rtensor())
x %X% x

Run the code above in your browser using DataLab