coef_-: Replace Coefficients

Description Usage Arguments Details Value Examples

Description

coef<- is a generic function which replaces the coefficients of a polynomial. coefficients<- is an alias for it.

Usage

1
2
3
4
5
coef(object, ...) <- value
coefficients(object, ...) <- value

## Default S3 replacement method:
coef(object, ...) <- value

Arguments

object

any object.

...

further arguments passed to or from other methods. The default method passes these arguments to as.numbers.

value

a numeric or complex vector, or an object which can be coerced by as.numbers to a numeric or complex vector.

Details

All attributes of object are retained except for the class attribute which is set to "polynomial".

Value

For coef<-, the updated object. (Note that the value of coef(object, ...) <- value is that of the assignment, value, not the return value from the left-hand side.)

Examples

1
2
3
4
5
6
7
8
9
x <- as.polynomial(Hermite(5))
names(x) <- c("a", "b", "c", "d", "e", "f")
print(x)

coef(x) <- 1:6
print(x)  # names are preserved

coef(x)[2] <- 0
print(x)

polynomial documentation built on Feb. 22, 2021, 5:08 p.m.