polynomial: Polynomials

Description Usage Arguments Details Value Examples

Description

Functions to create, coerce and check for polynomials.

Usage

1
2
3

Arguments

length

A non-negative integer specifying the desired length. Double values will be coerced to integer: supplying an argument of length other than one is an error.

x

object to be coerced or tested.

exponents

NULL or an integer vector of the same length as x.

...

further arguments passed to as.numbers.

Details

polynomial creates a double-precision vector of the specified length with each coefficient equal to 0 and exponents equal to seq(0L, length.out = length).

as.polynomial returns x if x is a polynomial. If not, it attempts to coerce its argument to be of double or complex type: most attributes will be stripped (excluding dim, dimnames and names). Finally, the "class" and "exponents" attibutes are populated.

Value

polynomial and as.polynomial both return polynomial objects.

is.polynomial returns TRUE or FALSE depending on whether its argument is a polynomial or not.

Examples

1
2
3
4
5
6
7
as.polynomial(c(0, 4, 2, -1))


## 'as.polynomial' reduces complex numbers to real numbers if appropriate.
## You can use 'strict = FALSE' to stop this conversion.
as.polynomial(complex(real = c(0, 4, 2, -1)))
as.polynomial(complex(real = c(0, 4, 2, -1)), strict = FALSE)

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