50% off | Unlimited Data & AI Learning
Get 50% off unlimited learning

mpoly (version 1.1.2)

hermite: Hermite polynomials

Description

Hermite polynomials as computed by orthopolynom.

Usage

hermite(degree, kind = "he", indeterminate = "x", normalized = FALSE)

Value

a mpoly object or mpolyList object

Arguments

degree

degree of polynomial

kind

"he" (default, probabilists', see Wikipedia article) or "h" (physicists)

indeterminate

indeterminate

normalized

provide normalized coefficients

Author

David Kahle calling code from the orthopolynom package

See Also

orthopolynom::hermite.h.polynomials(), orthopolynom::hermite.he.polynomials(), https://en.wikipedia.org/wiki/Hermite_polynomials

Examples

Run this code

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

hermite(0:5)
hermite(0:5, normalized = TRUE)
hermite(0:5, indeterminate = "t")



# visualize the hermite polynomials

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

s <- seq(-3, 3, length.out = 201)
N <- 5 # number of hermite polynomials to plot
(hermPolys <- hermite(0:N))

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

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


# hermite polynomials are orthogonal with respect to the gaussian kernel:
He2 <- as.function(hermite(2))
He3 <- as.function(hermite(3))
He4 <- as.function(hermite(4))

w <- dnorm
integrate(function(x) He2(x) * He3(x) * w(x), lower = -Inf, upper = Inf)
integrate(function(x) He2(x) * He4(x) * w(x), lower = -Inf, upper = Inf)
integrate(function(x) He3(x) * He4(x) * w(x), lower = -Inf, upper = Inf)



Run the code above in your browser using DataLab