scalar {stokes}R Documentation

Scalars and losing attributes

Description

Scalars: 00-forms and 00-tensors

Usage

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 00-form or 00-tensor

Details

A kk-tensor (including kk-forms) maps kk vectors to a scalar. If k=0k=0, then a 00-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 kk-form maps kk vectors to the reals: so a 00-form maps 00 vectors to the reals. This is what anyone on the planet would call a scalar. Similarly, a 00-tensor maps 00 vectors to the reals, and so is a scalar. Mathematically, there is no difference between 00-forms and 00-tensors, but the package makes 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 VkV^k to the real number zero, and a zero form is an alternating tensor mapping VkV^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(s)

Robin K. S. Hankin

See Also

zeroform

Examples


o <- scalar(5)
o
lose(o)

kform_general(1,0)  
kform_general(1,0,lose=FALSE)


[Package stokes version 1.2-1 Index]