scalar | R Documentation |
Scalars: \mjseqn0-forms and \mjseqn0-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)
s |
A scalar value; a number |
kform |
Boolean with default |
M |
Object of class |
lose |
In function |
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
.
The functions documented here return an object of class
kform
or ktensor
, except for is.scalar()
, which
returns a Boolean.
Robin K. S. Hankin
zeroform
o <- scalar(5)
o
lose(o)
kform_general(1,0)
kform_general(1,0,lose=FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.