scalar | R Documentation |
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)
s |
A scalar value; a number |
kform |
Boolean with default |
M |
Object of class |
lose |
In function |
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 is a scalar. Mathematically, there is no difference
between 0
-forms and 0
-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 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
.
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.