% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/hermite.R
\name{hermite}
\alias{hermite}
\title{Hermite polynomials}
\usage{
hermite(degree, kind = "he", indeterminate = "x", normalized = FALSE)
}
\arguments{
\item{degree}{degree of polynomial}

\item{kind}{"he" (default, probabilists', see Wikipedia article) or "h"
(physicists)}

\item{indeterminate}{indeterminate}

\item{normalized}{provide normalized coefficients}
}
\value{
a mpoly object or mpolyList object
}
\description{
Hermite polynomials as computed by orthopolynom.
}
\examples{

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)



}
\seealso{
\code{\link[orthopolynom:hermite.h.polynomials]{orthopolynom::hermite.h.polynomials()}},
\code{\link[orthopolynom:hermite.he.polynomials]{orthopolynom::hermite.he.polynomials()}},
\url{https://en.wikipedia.org/wiki/Hermite_polynomials}
}
\author{
David Kahle calling code from the orthopolynom package
}
