scipy 1.10.1 Pypi GitHub Homepage
Other Docs

ParametersReturnsBackRef
fixed_quad(func, a, b, args=(), n=5)

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.

Returns

val : float

Gaussian quadrature approximation to the integral

none : None

Statically returned value of None

Compute a definite integral using fixed-order Gaussian quadrature.

See Also

cumulative_trapezoid

cumulative integration for sampled data

dblquad

double integrals

ode

ODE integrator

odeint

ODE integrator

quad

adaptive quadrature using QUADPACK

quadrature

adaptive Gaussian quadrature

romb

integrators for sampled data

romberg

adaptive Romberg quadrature

simpson

integrators for sampled data

tplquad

triple integrals

Examples

from scipy import integrate
import numpy as np
f = lambda x: x**8
integrate.fixed_quad(f, 0.0, 1.0, n=4)
integrate.fixed_quad(f, 0.0, 1.0, n=5)
print(1/9.0)  # analytical result
integrate.fixed_quad(np.cos, 0.0, np.pi/2, n=4)
integrate.fixed_quad(np.cos, 0.0, np.pi/2, n=5)
np.sin(np.pi/2)-np.sin(0)  # analytical result
See :

Back References

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

scipy.integrate._quadrature:romb scipy.integrate._quadpack_py:quad scipy.integrate._quadrature:cumulative_trapezoid scipy.integrate._quadpack_py:dblquad scipy.integrate._quadrature:simpson scipy.integrate._quadpack_py:tplquad scipy.integrate._quadpack_py:nquad scipy.integrate._quadrature:romberg scipy.integrate._quadrature:quadrature

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.

scipy.integrate._quadpack_py:quad_quadpack_py:quadscipy.integrate._quadrature:simpson_quadrature:simpsonquadquadscipy.integrate._quadrature:romberg_quadrature:rombergquadraturequadraturescipy.integrate._quadpack_py:nquad_quadpack_py:nquadscipy.integrate._quadrature:quadrature_quadrature:quadratureodeodescipy.integrate._quadrature:romb_quadrature:rombscipy.integrate._quadpack_py:tplquad_quadpack_py:tplquadscipy.integrate._quadpack_py:dblquad_quadpack_py:dblquadscipy.integrate._quadrature:cumulative_trapezoid_quadrature:cumulative_trapezoidrombrombsimpsonsimpsonrombergrombergodeintodeint

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#177
type: <class 'function'>
Commit: