polynomial {polynom}R Documentation

Polynomials

Description

Construct, coerce to and test for polynomial objects.

Usage

polynomial(coef = c(0, 1))
as.polynomial(p)
is.polynomial(p)

Arguments

coef numeric vector, giving the polynomial coefficients in increasing order.
p an arbitrary R object.

Details

polynomial constructs a polynomial from its coefficients, i.e., p[1:k] specifies the polynomial

p_1 + p_2 x + p_3 x^2 + ... + p_k x^{k-1}

{p[1] + p[2]* x + p[3]* x^2 + ... + p[k]* x^(k-1)}. Internally, polynomials are simply numeric coefficient vectors of class "polynomial". Several useful methods are available for this class, such as coercion to character and function, extraction of the coeeficients, printing and plotting.

as.polynomial tries to coerce its arguments to a polynomial.

is.polynomial tests whether its argument is a polynomial (in the sense that it has class "polynomial".

Examples

polynomial(1:4)
as.polynomial(c(1,0,3,0))
polynomial(c(2,rep(0,10),1))


[Package Contents]