Scalars: \(0\)-forms and \(0\)-tensors

scalar(s,kform=TRUE,lose=FALSE)
is.scalar(M)
`0form`(s = 1, lose = FALSE)
`0tensor`(s = 1, lose = FALSE)
# S3 method for class 'kform'
lose(M)
# S3 method for class 'ktensor'
lose(M)

Arguments

s

A scalar value; a number

kform

Boolean with default TRUE meaning to return a kform and FALSE meaning to return a ktensor

M

Object of class ktensor or kform

lose

In function scalar(), Boolean with TRUE meaning to return a normal scalar, and default FALSE meaning to return a formal \(0\)-form or \(0\)-tensor

Details

A \(k\)-tensor (including \(k\)-forms) maps \(k\) vectors to a scalar. If \(k=0\), then a \(0\)-tensor maps no vectors to a scalar, that is, mapping nothing at all to a scalar, or what normal people would call a plain old scalar. Such forms are created by a couple of constructions in the package, specifically scalar(), kform_general(1,0) and contract(). These functions take a lose argument that behaves much like the drop argument in base extraction. Functions 0form() and 0tensor() are wrappers for scalar().

Function lose() takes an object of class ktensor or kform and, if of arity zero, returns the coefficient.

Note that function kform() always returns a kform object, it never loses attributes.

There is a slight terminological problem. A \(k\)-form maps \(k\) vectors to the reals: so a \(0\)-form maps \(0\) vectors to the reals. This is what anyone on the planet would call a scalar. Similarly, a \(0\)-tensor maps \(0\) vectors to the reals, and so it too is a scalar. Mathematically, there is no difference between \(0\)-forms and \(0\)-tensors, but the package print methods make a distinction:


> scalar(5,kform=TRUE)
An alternating linear map from V^0 to R with V=R^0:
     val
  =    5
> scalar(5,kform=FALSE)
A linear map from V^0 to R with V=R^0:
     val
  =    5
>

Compare zero tensors and zero forms. A zero tensor maps \(V^k\) to the real number zero, and a zero form is an alternating tensor mapping \(V^k\) to zero (so a zero tensor is necessarily alternating). See zero.Rd.

Value

The functions documented here return an object of class kform or ktensor, except for is.scalar(), which returns a Boolean.

Author

Robin K. S. Hankin

See also

Examples


o <- scalar(5)
o
#> An alternating linear map from V^0 to R with V=R^0:
#>      val
#>   =    5
lose(o)
#> [1] 5

kform_general(1,0)  
#> [1] 1
kform_general(1,0,lose=FALSE)
#> An alternating linear map from V^0 to R with V=R^0:
#>      val
#>   =    1