parameters: (deg)
return_statement: return x, w
docstring: Gauss-HermiteE quadrature.
  
      Computes the sample points and weights for Gauss-HermiteE 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/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
      -----
  
      .. versionadded:: 1.7.0
  
      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 / (He'_n(x_k) * He_{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:`He_n`, and then scaling the results to get
      the right value when integrating 1.
docstring_summary: Gauss-HermiteE quadrature.
docstring_tokens: Gauss - HermiteE quadrature .
function: def hermegauss(deg):
      """
      Gauss-HermiteE quadrature.
  
      Computes the sample points and weights for Gauss-HermiteE 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/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
      -----
  
      .. versionadded:: 1.7.0
  
      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 / (He'_n(x_k) * He_{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:`He_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 = hermecompanion(c)
      x = la.eigvalsh(m)
  
      # improve roots by one application of Newton
      dy = _normed_hermite_e_n(x, ideg)
      df = _normed_hermite_e_n(x, ideg - 1) * np.sqrt(ideg)
      x -= dy/df
  
      # compute the weights. We scale the factor to avoid possible numerical
      # overflow.
      fm = _normed_hermite_e_n(x, ideg - 1)
      fm /= np.abs(fm).max()
      w = 1/(fm * fm)
  
      # for Hermite_e we can also symmetrize
      w = (w + w[::-1])/2
      x = (x - x[::-1])/2
  
      # scale w to get the right value
      w *= np.sqrt(2*np.pi) / w.sum()
  
      return x, w
function_tokens: def hermegauss ( deg ) : 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 = hermecompanion ( c ) x = la . eigvalsh ( m ) # improve roots by one application of Newton dy = _normed_hermite_e_n ( x , ideg ) df = _normed_hermite_e_n ( x , ideg - 1 ) * np . sqrt ( ideg ) x -= dy / df # compute the weights. We scale the factor to avoid possible numerical # overflow. fm = _normed_hermite_e_n ( x , ideg - 1 ) fm /= np . abs ( fm ) . max ( ) w = 1 / ( fm * fm ) # for Hermite_e we can also symmetrize w = ( w + w [ : : - 1 ] ) / 2 x = ( x - x [ : : - 1 ] ) / 2 # scale w to get the right value w *= np . sqrt ( 2 * np . pi ) / w . sum ( ) return x , w