poly.calc(x, y, tol=sqrt(.Machine$double.eps), lab=dimnames(y)[[2]])
x
| numeric vector specifying either the zeros of the desired polynomial if this is the only non-missing argument, or the x-values for Lagrange interpolation. |
y
|
numeric vector or matrix specifying the y-values for the
Lagrange interpolation polynomial. If y is a matrix,
nrow(y) must equal length(x) , and each column of
y is used separately with x .
|
tol
| An absolute value tolerance, below which coefficients are treated as zero. |
lab
|
If y is a matrix, lab is used as the names vector
for the list result.
|
y
is a matrix, the result is a list of polynomials using
each column separately.
If x
only is given, repeated zeros are allowed. If x
and y
are given, repeated values in the x
vector must
have identical y
values associated with them (up to
tol
), otherwise the first y-value only is used and a warning
is issued.
polynomial
poly.calc(rep(1,3)) ## -1 + 3*x - 3*x^2 + x^3 poly.calc(0:4, (0:4)^2 + 1) ## 1 + x^2 poly.calc(0:4, cbind(0:4, (0:4)^2 + 1), lab = letters[1:2]) ## List of polynomials: ## $a: ## x ## ## $b: ## 1 + x^2