stokes (version 1.0-5)

Ops.kform: Arithmetic Ops Group Methods for kform and ktensor objects

Description

Allows arithmetic operators to be used for \(k\)-forms and \(k\)-tensors such as addition, multiplication, etc, where defined.

Usage

# S3 method for kform
Ops(e1, e2 = NULL)
# S3 method for ktensor
Ops(e1, e2 = NULL)

Arguments

e1,e2

Objects of class kform or ktensor

Value

All functions documented here return an object of class kform or ktensor.

Details

The functions Ops.kform() and Ops.ktensor() pass unary and binary arithmetic operators (“+”, “-”, “*”, and “/”) to the appropriate specialist function by coercing to spray objects.

For wedge products of \(k\)-forms, use wedge() or %^%; and for cross products of \(k\)-tensors, use cross() or %X%.

Examples

Run this code
# NOT RUN {
## dx_1 ^ dx_2 + 6dx_5 ^ dx_6:
as.kform(1) %^% as.kform(2) + 6*as.kform(5) %^% as.kform(6)

k1 <- kform_general(4,2,rnorm(6))
k2 <- kform_general(4,2,rnorm(6))

E <- matrix(rnorm(8),4,2)
as.function(k1+k2)(E)


as.function(2*k1+3*k2)(E)-(2*as.function(k1)(E) + 3*as.function(k1)(E))
## should be small
# }

Run the code above in your browser using DataLab