# NOT RUN {
x <- as.polynomial(Hermite(5))
plot(x, -3, 6, ylim = c(-10, 20))
## 'plot.polynomial' can be combined with 'reduce' for a different y label
## use 'add = NA' to use [from, to] from previous plot
plot(reduce(x, decreasing = TRUE), add = NA, ylim = c(-10, 20))
x <- as.polynomial(Chebyshev1(4))
plot(x, -1, 1, ylim = c(-1, 1))
## use 'xname' for a different x label (and polynomial variable)
plot(x, add = NA, ylim = c(-1, 1), xname = expression(cos(theta)))
## plot Chebyshev polynomials for 'n = 0, ..., 4'
plot(
as.polynomial(Chebyshev1(0)),
from = -1, to = 1, ylim = c(-1, 1),
xname = expression(cos(theta)),
ylab = expression(T[n](cos(theta)))
)
lines (as.polynomial(Chebyshev1(1)), col = "red")
lines (as.polynomial(Chebyshev1(2)), col = "green3")
points(as.polynomial(Chebyshev1(3)), col = "blue")
points(as.polynomial(Chebyshev1(4)), col = "deeppink2")
# }
Run the code above in your browser using DataLab