MCPcopy Create free account
hub / github.com/numpy/numpy / _normed_hermite_n

Function _normed_hermite_n

numpy/polynomial/hermite.py:1516–1556  ·  view source on GitHub ↗

Evaluate a normalized Hermite polynomial. Compute the value of the normalized Hermite polynomial of degree ``n`` at the points ``x``. Parameters ---------- x : ndarray of double. Points at which to evaluate the function n : int Degree of the normalized

(x, n)

Source from the content-addressed store, hash-verified

1514
1515
1516def _normed_hermite_n(x, n):
1517 """
1518 Evaluate a normalized Hermite polynomial.
1519
1520 Compute the value of the normalized Hermite polynomial of degree ``n``
1521 at the points ``x``.
1522
1523
1524 Parameters
1525 ----------
1526 x : ndarray of double.
1527 Points at which to evaluate the function
1528 n : int
1529 Degree of the normalized Hermite function to be evaluated.
1530
1531 Returns
1532 -------
1533 values : ndarray
1534 The shape of the return value is described above.
1535
1536 Notes
1537 -----
1538 .. versionadded:: 1.10.0
1539
1540 This function is needed for finding the Gauss points and integration
1541 weights for high degrees. The values of the standard Hermite functions
1542 overflow when n >= 207.
1543
1544 """
1545 if n == 0:
1546 return np.full(x.shape, 1/np.sqrt(np.sqrt(np.pi)))
1547
1548 c0 = 0.
1549 c1 = 1./np.sqrt(np.sqrt(np.pi))
1550 nd = float(n)
1551 for i in range(n - 1):
1552 tmp = c0
1553 c0 = -c1*np.sqrt((nd - 1.)/nd)
1554 c1 = tmp + c1*x*np.sqrt(2./nd)
1555 nd = nd - 1.0
1556 return c0 + c1*x*np.sqrt(2)
1557
1558
1559def hermgauss(deg):

Callers 1

hermgaussFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected