bundles / scipy latest / scipy / integrate / _rules / _gauss_legendre / GaussLegendreQuadrature
class
scipy.integrate._rules._gauss_legendre:GaussLegendreQuadrature
source: build-install/usr/lib/python3.14/site-packages/scipy/integrate/_rules/_gauss_legendre.py:11
Signature
class GaussLegendreQuadrature(npoints)Members
Summary
Gauss-Legendre quadrature.
Parameters
npoints: intNumber of nodes for the higher-order rule.
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
✗array([0])
rule.estimate_error(f, a, b)
⚠Traceback (most recent call last):
File "<doctest scipy.integrate._rules._gauss_legendre:GaussLegendreQuadrature[0]>", line 1, in <module>
rule.estimate_error(f, a, b)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "/home/runner/dev/scipy/build-install/usr/lib/python3.14/site-packages/scipy/integrate/_rules/_base.py", line 148, in estimate_error
for a_k, b_k in _split_subregion(a, b):
~~~~~~~~~~~~~~~~^^^^^^
TypeError: _split_subregion() missing 1 required positional argument: 'xp'
Aliases
scipy.integrate._rules.GaussLegendreQuadrature