Revision a7001ff1805634d18a10fa371b38dbe3e48f8c9e authored by HwB on 30 October 2011, 00:00:00 UTC, committed by Gabor Csardi on 30 October 2011, 00:00:00 UTC
1 parent 6b51622
polyval.Rd
\name{polyval}
\alias{polyval}
\title{Evaluating a Polynomial}
\description{
Evaluate polynomial given as a numeric vector.
}
\usage{
polyval(p, x)
}
\arguments{
\item{p}{vector representing a polynomial}
\item{x}{vector of values where to evaluate the polynomial}
}
\details{
Evaluate the polynomial given by \code{p} at the values specified
by the elements of \code{x}. If \code{x} is a matrix, the polynomial
will be evaluated at each element and a matrix returned.
}
\value{
vector of values
}
\seealso{
\code{\link{poly}}, \code{\link{roots}}
}
\examples{
# Evaluate 3 x^2 + 2 x + 1 at x = 5, 7, and 9
p = c(3, 2, 1);
polyval(p, c(5, 7, 9)) # 86 162 262
}
\keyword{ math }
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...