scipy 1.8.0 Pypi GitHub Homepage
Other Docs
ParametersReturnsBackRef
quadrature(func, a, b, args=(), tol=1.49e-08, rtol=1.49e-08, maxiter=50, vec_func=True, miniter=1)

Integrate :None:None:`func` from a to b using Gaussian quadrature with absolute tolerance :None:None:`tol`.

Parameters

func : function

A Python function or method to integrate.

a : float

Lower limit of integration.

b : float

Upper limit of integration.

args : tuple, optional

Extra arguments to pass to function.

tol, rtol : float, optional

Iteration stops when error between last two iterates is less than :None:None:`tol` OR the relative change is less than :None:None:`rtol`.

maxiter : int, optional

Maximum order of Gaussian quadrature.

vec_func : bool, optional

True or False if func handles arrays as arguments (is a "vector" function). Default is True.

miniter : int, optional

Minimum order of Gaussian quadrature.

Returns

val : float

Gaussian quadrature approximation (within tolerance) to integral.

err : float

Difference between last two estimates of the integral.

Compute a definite integral using fixed-tolerance Gaussian quadrature.

See Also

cumulative_trapezoid

cumulative integration for sampled data

dblquad

double integrals

fixed_quad

fixed-order Gaussian quadrature

ode

ODE integrator

odeint

ODE integrator

quad

adaptive quadrature using QUADPACK

romb

integrator for sampled data

romberg

adaptive Romberg quadrature

simpson

integrator for sampled data

tplquad

triple integrals

Examples

>>> from scipy import integrate
... f = lambda x: x**8
... integrate.quadrature(f, 0.0, 1.0) (0.11111111111111106, 4.163336342344337e-17)
>>> print(1/9.0)  # analytical result
0.1111111111111111
>>> integrate.quadrature(np.cos, 0.0, np.pi/2)
(0.9999999999999536, 3.9611425250996035e-11)
>>> np.sin(np.pi/2)-np.sin(0)  # analytical result
1.0
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

scipy.integrate._quadrature.simpson scipy.integrate._quadpack_py.dblquad scipy.integrate._quadrature.quadrature scipy.integrate._quadrature.romb scipy.integrate._quadrature.fixed_quad scipy.integrate._quadrature.cumulative_trapezoid scipy.integrate._quadpack_py.quad scipy.integrate._quadrature.vectorize1 scipy.integrate._quadpack_py.nquad scipy.integrate._quadpack_py.tplquad

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /scipy/integrate/_quadrature.py#199
type: <class 'function'>
Commit: