API Documentation

Adaptive integration of a callable function or method

quadgk(fun, interval[, args, full_output, ...])

Global adaptive quadrature using Gauss-Kronrod rule.

quadcc(fun, interval[, args, full_output, ...])

Global adaptive quadrature using Clenshaw-Curtis rule.

quadts(fun, interval[, args, full_output, ...])

Global adaptive quadrature using trapezoidal tanh-sinh rule.

romberg(fun, interval[, args, full_output, ...])

Romberg integration of a callable function or method.

tanhsinh(fun, interval[, args, full_output, ...])

Tanh-sinh (aka double exponential) quadrature on a uniformly refined mesh.

adaptive_quadrature(rule, fun, interval[, ...])

Global adaptive quadrature with user specified local rule.

Adaptive integration over a region in several dimensions

See Integrating over more than one dimension for which rule to use at which dimension, and for the regions interval can describe.

cubegm(fun, interval[, args, full_output, ...])

Global adaptive cubature over a box using a Genz-Malik rule.

adaptive_cubature(rule, fun, interval[, ...])

Global adaptive cubature with user specified local rule.

Quadrature Rules

One dimensional rules, taken by adaptive_quadrature() and used to build tensor product cubature rules.

AbstractQuadratureRule()

Abstract base class for 1D quadrature rules.

NestedRule(_xh, _wh, _wl, _norm, _batch_size)

Base class for nested quadrature rules.

GaussKronrodRule([order, norm, batch_size])

Integrate a function from a to b using a fixed order Gauss-Kronrod rule.

ClenshawCurtisRule([order, norm, ...])

Integrate a function from a to b using a fixed order Clenshaw-Curtis rule.

TanhSinhRule([order, norm, batch_size])

Integrate a function from a to b using a fixed order Tanh-Sinh trapezoidal rule.

Cubature Rules

Rules over a box in several dimensions, taken by adaptive_cubature().

AbstractCubatureRule()

Abstract base class for cubature rules over an n-dimensional box.

GenzMalikRule(ndim[, degree, norm, batch_size])

Integrate a function over a box using a fixed degree Genz-Malik rule.

TensorProductRule(rules[, ndim, norm, ...])

Integrate a function over a box using a tensor product of 1D nested rules.

Adjoints

Adjoints control how derivatives of a quadrature are computed, without changing what the quadrature itself returns. Pass one as the adjoint argument. See Differentiation for how to choose between them, how to give the derivative solve options of its own, and which vector its norm measures.

AbstractAdjoint()

Abstract base class for adjoint methods.

DirectAdjoint([checkpoint, chunk_size])

Differentiate the quadrature exactly, reusing the converged subdivision.

LeibnizAdjoint(options, options_fwd, ...)

Differentiate by the Leibniz rule, either mode, with its own error control.

Results and termination status

Every iterative routine returns its result alongside a QuadratureInfo, whose status says why it stopped. See Diagnostics for how to read one and what to do about each code.

QuadratureInfo(err, neval, status, info)

Information about quadrature.

STATUS(value)

Reason a quadrature terminated.

Integrating function from sampled values

trapezoid(y, *[, x, dx, axis])

Integrate along the given axis using the composite trapezoidal rule.

cumulative_trapezoid(y, *[, x, dx, axis, ...])

Cumulatively integrate y(x) using the composite trapezoidal rule.

simpson(y, *[, x, dx, axis])

Integrate y(x) from samples using the composite Simpson's rule.

cumulative_simpson(y, *[, x, dx, axis, initial])

Cumulatively integrate y(x) using the composite Simpson's 1/3 rule.