polynomial              package:polynom              R Documentation

_P_o_l_y_n_o_m_i_a_l_s

_D_e_s_c_r_i_p_t_i_o_n:

     Construct, coerce to, test for, and print polynomial objects.

_U_s_a_g_e:

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

     ## S3 method for class 'polynomial':
     as.character(x, decreasing = FALSE, ...)
     ## S3 method for class 'polynomial':
     print(x, digits = getOption("digits"), decreasing = FALSE, ...)

_A_r_g_u_m_e_n_t_s:

    coef: numeric vector, giving the polynomial coefficients in
          _in_creasing order.

       p: an arbitrary R object.

       x: a 'polynomial' object.

decreasing: a logical specifying the order of the terms; in increasing
          (default) or decreasing powers.

  digits: the number of significant digits to use for printing.

     ...: potentially further arguments passed to and from other
          methods.

_D_e_t_a_i_l_s:

     '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 ('as.character()') and
     function ('as.function.polynomial'), extraction of the
     coefficients ('coef()'), printing (using 'as.character'), plotting
     ('plot.polynomial'), and computing sums and products of
     arbitrarily many polynomials.

     '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"'.

_E_x_a_m_p_l_e_s:

     polynomial(1:4)
     p <- as.polynomial(c(1,0,3,0))
     p
     print(p, decreasing = TRUE)
     stopifnot(coef(p) == c(1,0,3))

     polynomial(c(2,rep(0,10),1))

