print: Print methods for k-tensors and k-forms

print.stokesR Documentation

Print methods for k-tensors and k-forms

Description

Print methods for objects with options for printing in matrix form or multivariate polynomial form

Usage

## S3 method for class 'kform'
print(x, ...)
## S3 method for class 'ktensor'
print(x, ...)

Arguments

x

k-form or k-tensor

...

Further arguments (currently ignored)

Details

The print method is designed to tell the user that an object is a tensor or a k-form. It prints a message to this effect (with special dispensation for zero tensors), then calls the spray print method.

Value

Returns its argument invisibly.

Note

The print method asserts that its argument is a map from V^k to \mathbb{R} with V=\mathbb{R}^n. Here, n is the largest element in the index matrix. However, such a map naturally furnishes a map from (\mathbb{R}^m)^k to \mathbb{R}, provided that m\geq n via the natural projection from \mathbb{R}^n to \mathbb{R}^m. Formally this would be \left(x_1,\ldots,x_n\right)\mapsto\left(x_1,\ldots,x_n,0,\ldots,0\right)\in\mathbb{R}^m. In the case of the zero k-form or k-tensor, “n” is to be interpreted as “any n\geq 0”. See also dovs().

By default, the print method uses the spray print methods, and as such respects the polyform option. However, setting polyform to TRUE can give misleading output, because spray objects are interpreted as multivariate polynomials not differential forms (and in particular uses the caret to signify powers).

It is much better to use options ktensor_symbolic_print or kform_symbolic_print instead. If these options are non-null, the print method uses as.symbolic() to give an alternate way of displaying k-tensors and k-forms. The generic non-null value would be “x” which gives output like “dx1 ^ dx2”. However, it has two special values: set kform_symbolic_print to “dx” for output like “dx ^ dz” and “txyz” for output like “dt ^ dx”, useful in relativistic physics with a Minkowski metric. See the examples.

More detail is given at symbolic.Rd and the dx vignette.

Author(s)

Robin K. S. Hankin

See Also

as.symbolic,dovs

Examples


a <- rform()
a

options(kform_symbolic_print = "x")
a


options(kform_symbolic_print = "dx")
kform(spray(kform_basis(3,2),1:3))


kform(spray(kform_basis(4,2),1:6))  # runs out of symbols


options(kform_symbolic_print = "txyz")
kform(spray(kform_basis(4,2),1:6))  # standard notation


options(kform_symbolic_print = NULL) # revert to default
a


stokes documentation built on June 22, 2024, 11:56 a.m.