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

poly_calc

Lagrange interpolation polynomial


Description

Calculate the Lagrange interpolation polynomial, or list of polynomials, given a set of (x, y) points to fit

Usage

poly_calc(x, y, tol = sqrt(.Machine$double.eps), lab = dimnames(y)[[2]])

poly_from_zeros(...)

poly_from_roots(...)

poly_from_roots(...)

poly_from_values(x, y, tol = sqrt(.Machine$double.eps), lab = dimnames(y)[[2]])

Arguments

x

A numeric vector of x-points at which the y-values are specified.

y

Either a numeric vector of the same length as x or a numeric matrix with rows matching the length of x. If y is missing (not specified) then a polynomial with zero at x is returned.

tol

A numeric tolerance for duplicated x values.

lab

A character string vector of names for the list result when y is a matrix.

...

A list of specified zeros (for subsidiary functions)

Value

An interpolation polynomial, or list of interpolating polynomials.

Examples

(p <- poly_calc(0:5)) ## same as poly_from_zeros(0:5)
(p <- poly_calc(0:5, exp(0:5)))
plot(p)
curve(exp, add = TRUE, col = "red")

PolynomF

Polynomials in R

v2.0-3
GPL-2
Authors
Bill Venables, with contribution by Kurt Hornik and Georgi Boshnakov
Initial release
2020-02-04

We don't support your browser anymore

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