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.

Quadrature 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.

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, options_rev)

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.