polynomial {polynom} | R Documentation |
Construct, coerce to and test for polynomial objects.
polynomial(coef = c(0, 1)) as.polynomial(p) is.polynomial(p)
coef |
numeric vector, giving the polynomial coefficients in increasing order. |
p |
an arbitrary R object. |
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)
.
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"
.
polynomial(1:4) as.polynomial(c(1,0,3,0)) polynomial(c(2,rep(0,10),1))