chebPoly | R Documentation |
Chebyshev polynomials and their values.
chebPoly(n, x = NULL)
n |
an integer |
x |
a numeric vector, possibly empty; default |
Determines an (n+1)-ny-(n+1)-Matrix of Chebyshev polynomials up to degree n.
The coefficients of the first n
Chebyshev polynomials are computed
using the recursion formula. For computing any values at points the well
known Horner schema is applied.
If x
is NULL
, returns an (n+1)
-by-(n+1)
matrix
with the coefficients of the first Chebyshev polynomials from 0
to
n
, one polynomial per row with coefficients from highest to lowest
order.
If x
is a numeric vector, returns the values of the n
-th
Chebyshev polynomial at the points of x
.
See the “Chebfun Project” <https://www.chebfun.org/> by Nick Trefethen.
Carothers, N. L. (1998). A Short Course on Approximation Theory. Bowling Green State University.
chebCoeff
, chebApprox
chebPoly(6)
## Not run:
## Plot 6 Chebyshev Polynomials
plot(0, 0, type="n", xlim=c(-1, 1), ylim=c(-1.2, 1.2),
main="Chebyshev Polynomials for n=1..6", xlab="x", ylab="y")
grid()
x <- seq(-1, 1, length.out = 101)
for (i in 1:6) {
y <- chebPoly(i, x)
lines(x, y, col=i)
}
legend(x = 0.55, y = 1.2, c("n=1", "n=2", "n=3", "n=4", "n=5", "n=6"),
col = 1:6, lty = 1, bg="whitesmoke", cex = 0.75)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.