scalar: Scalars and losing attributes

scalarR Documentation

Scalars and losing attributes

Description

\loadmathjax

Scalars: \mjseqn0-forms and \mjseqn0-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 \mjseqn0-form or \mjseqn0-tensor

Details

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


stokes documentation built on Aug. 19, 2023, 1:07 a.m.