numpy.polynomial.hermite.hermgauss#
- polynomial.hermite.hermgauss(deg)[source]#
Gauss-Hermite quadrature.
Computes the sample points and weights for Gauss-Hermite quadrature. These sample points and weights will correctly integrate polynomials of degree \(2*deg - 1\) or less over the interval \([-\inf, \inf]\) with the weight function \(f(x) = \exp(-x^2)\).
- Parameters:
- degint
Number of sample points and weights. It must be >= 1.
- Returns:
- xndarray
1-D ndarray containing the sample points.
- yndarray
1-D ndarray containing the weights.
Notes
The results have only been tested up to degree 100, higher degrees may be problematic. The weights are determined by using the fact that
\[w_k = c / (H'_n(x_k) * H_{n-1}(x_k))\]where \(c\) is a constant independent of \(k\) and \(x_k\) is the k’th root of \(H_n\), and then scaling the results to get the right value when integrating 1.
Examples
>>> from numpy.polynomial.hermite import hermgauss >>> hermgauss(2) (array([-0.70710678, 0.70710678]), array([0.88622693, 0.88622693]))