scipy.integrate.fixed_quad(func, a, b, args=(), n=5)[source]

Compute a definite integral using fixed-order Gaussian quadrature.

Integrate func from a to b using Gaussian quadrature of order n.

Parameters: func : callable A Python function or method to integrate (must accept vector inputs). If integrating a vector-valued function, the returned array must have shape (..., len(x)). a : float Lower limit of integration. b : float Upper limit of integration. args : tuple, optional Extra arguments to pass to function, if any. n : int, optional Order of quadrature integration. Default is 5. val : float Gaussian quadrature approximation to the integral none : None Statically returned value of None

quad
dblquad
double integrals
tplquad
triple integrals
romberg
quadrature
romb
integrators for sampled data
simps
integrators for sampled data
cumtrapz
cumulative integration for sampled data
ode
ODE integrator
odeint
ODE integrator

Examples

>>> from scipy import integrate
>>> f = lambda x: x**8
(0.1110884353741496, None)
(0.11111111111111102, None)
>>> print(1/9.0)  # analytical result
0.1111111111111111

>>> integrate.fixed_quad(np.cos, 0.0, np.pi/2, n=4)
(0.9999999771971152, None)