Did I find the right examples for you? yes no

# numpy.polynomial.hermite.hermgauss

All Samples(6)  |  Call(4)  |  Derive(0)  |  Import(2)
```Gauss-Hermite quadrature.

Computes the sample points and weights for Gauss-Hermite quadrature.
These sample points and weights will correctly integrate polynomials of
degree :math:`2*deg - 1` or less over the interval :math:`[-\inf, \inf]`
with the weight function :math:`f(x) = \exp(-x^2)`.

Parameters
----------
deg : int(more...)
```

```        def hermgauss(deg):
"""

Computes the sample points and weights for Gauss-Hermite quadrature.
These sample points and weights will correctly integrate polynomials of
degree :math:`2*deg - 1` or less over the interval :math:`[-\inf, \inf]`
with the weight function :math:`f(x) = \exp(-x^2)`.

Parameters
----------
deg : int
Number of sample points and weights. It must be >= 1.

Returns
-------
x : ndarray
1-D ndarray containing the sample points.
y : ndarray
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

.. math:: w_k = c / (H'_n(x_k) * H_{n-1}(x_k))

where :math:`c` is a constant independent of :math:`k` and :math:`x_k`
is the k'th root of :math:`H_n`, and then scaling the results to get
the right value when integrating 1.

"""
ideg = int(deg)
if ideg != deg or ideg < 1:
raise ValueError("deg must be a non-negative integer")

# first approximation of roots. We use the fact that the companion
# matrix is symmetric in this case in order to obtain better zeros.
c = np.array([0]*deg + [1])
m = hermcompanion(c)
x = la.eigvals(m)
x.sort()

# improve roots by one application of Newton
dy = hermval(x, c)
df = hermval(x, hermder(c))
x -= dy/df

# compute the weights. We scale the factor to avoid possible numerical
# overflow.
fm = hermval(x, c[1:])
fm /= np.abs(fm).max()
df /= np.abs(df).max()
w = 1/(fm * df)

# for Hermite we can also symmetrize
w = (w + w[::-1])/2
x = (x - x[::-1])/2

# scale w to get the right value
w *= np.sqrt(np.pi) / w.sum()

return x, w
```

```    ])

from numpy.polynomial.hermite import hermgauss as  hermgauss_numpy

[xg,wg] = hermgauss_numpy(10)
```

```    ])

from numpy.polynomial.hermite import hermgauss as  hermgauss_numpy

[xg,wg] = hermgauss_numpy(10)
```

```    def test_100(self):
x, w = herm.hermgauss(100)

# test orthogonality. Note that the results need to be normalized,
# otherwise the huge values that can arise from fast growing
```

```    def test_100(self):