File: polynomial.Rd

package info (click to toggle)
r-cran-polynom 1.4-1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 212 kB
  • sloc: makefile: 2
file content (57 lines) | stat: -rw-r--r-- 2,001 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
\name{polynomial}
\alias{polynomial}
\alias{as.polynomial}
\alias{is.polynomial}
\alias{as.character.polynomial}
\alias{print.polynomial}
\alias{coef.polynomial}
\title{Polynomials}
\description{
  Construct, coerce to, test for, and print polynomial objects.
}
\usage{
polynomial(coef = c(0, 1))
as.polynomial(p)
is.polynomial(p)

\method{as.character}{polynomial}(x, decreasing = FALSE, \dots)
\method{print}{polynomial}(x, digits = getOption("digits"), decreasing = FALSE, \dots)
}
\arguments{
  \item{coef}{numeric vector, giving the polynomial coefficients in
    \emph{in}creasing order.}
  \item{p}{an arbitrary \R object.}
  \item{x}{a \code{polynomial} object.}
  \item{decreasing}{a logical specifying the order of the terms;
    in increasing (default) or decreasing powers.}
  \item{digits}{the number of significant digits to use for printing.}
  \item{\dots}{potentially further arguments passed to and from other methods.}
}
\details{
  \code{polynomial} constructs a polynomial from its coefficients,
  i.e., \code{p[1:k]} specifies the polynomial
  \deqn{p_1 + p_2 x + p_3 x^2 + \dots + 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 \code{"polynomial"}.  Several useful methods are available for
  this class, such as coercion to character (\code{as.character()}) and
  function (\code{\link{as.function.polynomial}}), extraction of
  the coefficients (\code{coef()}), printing (using \code{as.character}),
  plotting (\code{\link{plot.polynomial}}), and computing sums and
  products of arbitrarily many polynomials.

  \code{as.polynomial} tries to coerce its arguments to a polynomial.

  \code{is.polynomial} tests whether its argument is a polynomial (in
  the sense that it has class \code{"polynomial"}.
}
\examples{
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))
}
\keyword{symbolmath}