bundles / scipy 1.17.1 / scipy / integrate / _rules / _gauss_legendre / GaussLegendreQuadrature
class
scipy.integrate._rules._gauss_legendre:GaussLegendreQuadrature
Signature
class GaussLegendreQuadrature ( npoints , xp = None ) Members
Summary
Gauss-Legendre quadrature.
Parameters
npoints: intNumber of nodes for the higher-order rule.
xp: array_namespace, optionalThe namespace for the node and weight arrays. Default is None, where NumPy is used.
Examples
Evaluate a 1D integral. Note in this example that ``f`` returns an array, so the estimates will also be arrays.import numpy as np from scipy.integrate import cubature from scipy.integrate._rules import GaussLegendreQuadrature def f(x): return np.cos(x) rule = GaussLegendreQuadrature(21) # Use 21-point GaussLegendre a, b = np.array([0]), np.array([1])✓
rule.estimate(f, a, b) # True value sin(1), approximately 0.84147
✗rule.estimate_error(f, a, b)
⚠Aliases
-
scipy.integrate._rules.GaussLegendreQuadrature