Skip to content

Hermite Functions🍋

evaluate_hermite_expansion(x, coeff=np.zeros(1)) 🍋

Evaluate at x a function determined by its coefficients in the Hermite expansion.

Parameters:

Name Type Description Default
x ndarray

numpy array containing the points where the expansion is evaluated.

required
coeff ndarray

numpy array containing the coefficients in the Hermite expansion (the n-th element is the coefficient associated to the n-th Hermite polynomial).

zeros(1)

Returns:

Type Description
ndarray

numpy array containing the approximation of the function in a truncated Hermite expansion at x (the function is vectorized).

hermite_coefficients_piecewise_linear(n, x, y, extension=ExtrapolationMethod.CONSTANT, sort=True, error=False) 🍋

Computes the Hermite coefficients of a piece-wise linear function continuous in an interval, with a desired extension outside the interval.

Parameters:

Name Type Description Default
n int

non-negative integer indicating the order up to which the Hermite coefficients are obtained.

required
x ndarray

numpy array of points in the real line indicating the breakpoints for the pice-wise linear function. Hence the function is continuous within the interval [x[0] , x[x.size-1]]. The elements of x must all be different with respect to each other.

required
y ndarray

numpy array indicating the images of the breakpoints x of the piece-wise linear function. It must have the same number of elements as x.

required
extension ExtrapolationMethod

string indicating the definition of the function outside the pice-wise linear intervale. Two options available: "constant" and "null". "constant": (default option) the function is continuously extended having constant values over the two sides of the interval. "null": the function is null outside the interval. Thus may imply that the resulting function is not continuous over the whole real line.

CONSTANT
sort bool

boolean (by default True). If True, it is supposed that the values in x are sorted. If false, the arrays x and y are sorted according to x's sorting order.

True
error bool

boolean (by default False). If True, the approximation error (L^2 norm with Gaussian weight) will be retourned as a second element of the output list.

False

Returns:

Type Description
ndarray

numpy array containing the first coefficients in the Hermite expansion of the function. If Error=True, a (n,2) array, the first element containing the coefficients (previous output) and the second containing the error of the Hermite approximation.

Raises:

Type Description
ValueError
  • Number of given polynomials must be positive.
  • Real and Gaussian datasets must have the same size.
  • Real values must be unique.

hermite_polynomials(x, n) 🍋

Function to compute the Hermite polynomials up to order n.

Parameters:

Name Type Description Default
x ndarray

numpy array containing the points where the polynomials are evaluated (this function is vectorized).

required
n int

non-negative integer indicating the maximal order of the desired polynomials.

required

Returns:

Type Description
ndarray

Numpy matrix of shape (n+1 , x.size) whose k-th row contains the Hermite polynomial of order k evaluated at x.


Last update: 2022-01-06