Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

polynEval

Evaluate Polynomials


Description

Evaluate a univariate polynomial at x (typically a vector), that is, compute, for a given vector of coefficients coef, the polynomial coef[1] + coef[2]*x + ... + coef[p+1]*x^p.

Usage

polynEval(coef, x)

Arguments

coef

numeric vector. If a vector, x can be an array and the result matches x.

x

numeric vector or array.

Details

The stable Horner rule is used for evaluation.

Using the C code speeds up the already fast R code available in polyn.eval() in package sfsmisc.

Value

numeric vector or array, with the same dimensions as x, containing the polynomial values p(x).

See Also

For a much more sophisticated treatment of polynomials, use the polynom package (for example, evaluation can be done via predict.polynomial).

Examples

polynEval(c(1,-2,1), x = -2:7) # (x - 1)^2
polynEval(c(0, 24, -50, 35, -10, 1),
          x = matrix(0:5, 2,3)) # 5 zeros!

copula

Multivariate Dependence with Copulas

v1.0-1
GPL (>= 3) | file LICENCE
Authors
Marius Hofert [aut] (<https://orcid.org/0000-0001-8009-4665>), Ivan Kojadinovic [aut] (<https://orcid.org/0000-0002-2903-1543>), Martin Maechler [aut, cre] (<https://orcid.org/0000-0002-8685-9910>), Jun Yan [aut] (<https://orcid.org/0000-0003-4401-7296>), Johanna G. Nešlehová [ctb] (evTestK(), <https://orcid.org/0000-0001-9634-4796>), Rebecca Morger [ctb] (fitCopula.ml(): code for free mixCopula weight parameters)
Initial release
2020-12-07

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.