pystra.quadrature.quadratureRule#
- quadratureRule(n, wfun=None, alpha=None, beta=None)[source]#
Compute Gauss-Legendre quadrature points and weights.
Returns n base points (abscissas) and corresponding weight factors for Gauss-Legendre quadrature on the interval [-1, 1]. An n-point rule integrates polynomials of degree up to 2*n* - 1 exactly.
The algorithm follows Davis and Rabinowitz, Methods of Numerical Integration, Academic Press, 1975, p. 365.
- Parameters:
n (int) – Number of quadrature points.
wfun (int, optional) – Weight function selector (only
1— Gauss-Legendre — is implemented).alpha (float, optional) – Not used for Gauss-Legendre; must be > -1 if supplied.
beta (float, optional) – Not used for Gauss-Legendre; must be > -1 if supplied.
- Returns:
bp (ndarray) – Base points (abscissas) in [-1, 1], length n.
wf (ndarray) – Corresponding weight factors, length n.