Contents
ALGORITHMS
Site map
Links
Site and author
News
About the site
FAQ
Contact
TERMS OF USE
Contents - Numerical integration - Gaussian quadratures - Computation of Gauss-Hermite quadrature rule nodes and weights

Computation of Gauss-Hermite quadrature rule nodes and weights

The Gauss-Hermite quadrature formula is used to numerically calculate the integral integral(exp(-power(x,2))f(x)dx,-∞,+∞) by using the formula integral(exp(-power(x,2))f(x)dx,-∞,+∞) = sum(w_i_f(x_i_),i=0,n-1)+E_n_

We can also get onto the integral integral(exp(-div(power(x-a,2),power(b,2)))f(x)dx,-∞,+∞) by using a change of variables which will also change both nodes x and weights w. But we will consider the simplest case only. If you perform a change of variables, you should take into account that the formula of error term E is changed along with the nodes and weights (you can get a new form by changing the variables in the formula).

The Gauss-Hermite quadrature formula for each number of points is completely defined by the set of nodes x and weights w. The algorithm finds these numbers.

Algorithm of nodes and weights calculation

The closed form of the nodes and weights is known only for a small n. Generally, we have to find them numerically. The integration nodes for the n points formula are found as a root of the Hermite polynomial of order n. The root search is an iterative process. An initial approximation is selected for each root and then the roots are found by using the Newton method. Therefore, the bigger n was selected, the bigger order the Hermite polynomial has, and more time is required to find a root with the desired accuracy. The recurrence formula for Hermite polynomials calculation has the following form:

H-1  = 0
H = 1
Hj+1  = 2xH-2jHj-1 

After calculating x (roots of the Hermite polynomials of n-th order) weights w are calculated by using the following formula:

w_i_ = div(power(2,n-1)n!sqrt(π),power(n,2)power(H_n-1_(x_i_),2))

Error term

The formula with n points is accurate for the polynomials of order 2n-1 and lower. Error term E is:

E_n_ = div(n!sqrt(π),power(2,n)(2n)!)power(f,(2n))(ξ)   -∞ < ξ < +∞

Subroutine description

The algorithm gets as the input

  • n - a required number of nodes. 1 ≤ n ≤ 190. If n > 190, the initial approximations for the roots of the Hermite polynomial of the n-th order could not provide a convergence to the different roots. That leads to getting a wrong nodes and weights.

The algorithm returns:

  • x - array of nodes. Its index ranges within 0 and n-1.
  • w - array of weighting coefficients. Its index ranges between 0 and n-1.

The source code was designed by using information from the QUADRULE library.

Links

  1. Eric W. Weisstein. "Hermite-Gauss Quadrature." From MathWorld--A Wolfram Web Resource

Report a bug

Source codes

C#

C# 1.0 source.
gqgenhermite.csharp.zip - Computation of Gauss-Hermite quadrature rule nodes and weights


C++

C++ source.
gqgenhermite.cpp.zip - Computation of Gauss-Hermite quadrature rule nodes and weights
ablas.zip - optimized basic linear algebra subroutines with SSE2 support (for C++ sources only)


C++, multiple precision arithmetic

C++ source. MPFR/GMP is used.
GMP source is available from gmplib.org. MPFR source is available from www.mpfr.org.
gqgenhermite.mpfr.zip - Computation of Gauss-Hermite quadrature rule nodes and weights
mpfr.zip - precompiled Win32 MPFR/GMP binaries


Delphi

Delphi source.
Can be compiled under FPC (in Delphi compatibility mode).
gqgenhermite.delphi.zip - Computation of Gauss-Hermite quadrature rule nodes and weights


Visual Basic 6

Visual Basic 6 source.
gqgenhermite.vb6.zip - Computation of Gauss-Hermite quadrature rule nodes and weights


Zonnon beta

Zonnon source.
Zonnon is an experimental language developed at ETH Zurich.
See www.zonnon.ethz.ch for more information.
gqgenhermite.zonnon.zip - Computation of Gauss-Hermite quadrature rule nodes and weights



 
 
Sergey Bochkanov, Vladimir Bystritsky
Copyright © 1999-2008