constant: Get or set the constant term of a spray object

constantR Documentation

Get or set the constant term of a spray object

Description

The constant term of a spray object is the coefficient corresponding to an index of all zeros. These functions get or set the constant of a spray object.

Usage

is.constant(x)
constant(x,drop=FALSE)
constant(x) <- value
drop(x)

Arguments

x

Object of class spray

value

Numeric value to set the constant coefficient to

drop

Boolean, with default FALSE meaning to return a spray object and TRUE meaning to return a numeric value

Value

In function constant(), return the coefficient, or a constant multivariate polynomial, depending on the value of drop.

Note

The behaviour of the drop argument (sort of) matches that of the spray extractor method. Function drop() returns the elements of the coefficients.

Function constant() ensures that zero spray objects retain the argument's arity.

It might have been better to call is.constant() is.scalar(), for consistency with the stokes and clifford packages. But this is not clear.

Author(s)

Robin K. S. Hankin

See Also

Extract

Examples

(S <- spray(partitions::blockparts(rep(2,3),3,TRUE)))

constant(S)
constant(S) <- 33

S

drop(constant(S,drop=FALSE))

spray documentation built on Aug. 10, 2023, 5:11 p.m.