wedge (version 1.0-3)

scalar: Lose attributes

Description

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

Usage

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

Arguments

s

A scalar value; a number

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.

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.

A \(0\)-form is not the same thing as a zero tensor. A \(0\)-form maps \(V^0\) to the reals; a scalar. A zero tensor maps \(V^k\) to zero.

See Also

zeroform,lose

Examples

Run this code
# NOT RUN {
o <- scalar(5)
o
lose(o)

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

# }

Run the code above in your browser using DataCamp Workspace