Last data update: 2014.03.03

R: Chebyshev polynomials
chebyshevR Documentation

Chebyshev polynomials

Description

Chebyshev polynomials as computed by orthopolynom.

Usage

chebyshev(degree, kind = "t", indeterminate = "x", normalized = FALSE)

Arguments

degree

degree of polynomial

kind

"t" or "u" (Chebyshev polynomials of the first and second kinds), or "c" or "s"

indeterminate

indeterminate

normalized

provide normalized coefficients

Value

a mpoly object or mpolyList object

Author(s)

David Kahle calling code from the orthopolynom package

See Also

chebyshev.t.polynomials, chebyshev.u.polynomials, chebyshev.c.polynomials, chebyshev.s.polynomials, http://en.wikipedia.org/wiki/Chebyshev_polynomials

Examples


chebyshev(0)
chebyshev(1)
chebyshev(2)
chebyshev(3)
chebyshev(4)
chebyshev(5)
chebyshev(6)
chebyshev(10)

chebyshev(0:5) 
chebyshev(0:5, normalized = TRUE)
chebyshev(0:5, kind = "u")
chebyshev(0:5, kind = "c")
chebyshev(0:5, kind = "s")
chebyshev(0:5, indeterminate = "t")



# visualize the chebyshev polynomials

library(ggplot2); theme_set(theme_classic())
library(tidyr)

s <- seq(-1, 1, length.out = 201)
N <- 5 # number of chebyshev polynomials to plot
(chebPolys <- chebyshev(0:N))

# see ?bernstein for a better understanding of
# how the code below works

df <- data.frame(s, as.function(chebPolys)(s))
names(df) <- c("x", paste0("T_", 0:N))
mdf <- gather(df, degree, value, -x)
qplot(x, value, data = mdf, geom = "line", color = degree)



Results