SciPy

Integration and ODEs (scipy.integrate)

Integrating functions, given function object

quad(func, a, b[, args, full_output, …])

Compute a definite integral.

quad_vec(f, a, b[, epsabs, epsrel, norm, …])

Adaptive integration of a vector-valued function.

dblquad(func, a, b, gfun, hfun[, args, …])

Compute a double integral.

tplquad(func, a, b, gfun, hfun, qfun, rfun)

Compute a triple (definite) integral.

nquad(func, ranges[, args, opts, full_output])

Integration over multiple variables.

fixed_quad(func, a, b[, args, n])

Compute a definite integral using fixed-order Gaussian quadrature.

quadrature(func, a, b[, args, tol, rtol, …])

Compute a definite integral using fixed-tolerance Gaussian quadrature.

romberg(function, a, b[, args, tol, rtol, …])

Romberg integration of a callable function or method.

quad_explain([output])

Print extra information about integrate.quad() parameters and returns.

newton_cotes(rn[, equal])

Return weights and error coefficient for Newton-Cotes integration.

IntegrationWarning

Warning on issues during integration.

AccuracyWarning

Integrating functions, given fixed samples

trapz(y[, x, dx, axis])

Integrate along the given axis using the composite trapezoidal rule.

cumtrapz(y[, x, dx, axis, initial])

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

simps(y[, x, dx, axis, even])

Integrate y(x) using samples along the given axis and the composite Simpson’s rule.

romb(y[, dx, axis, show])

Romberg integration using samples of a function.

See also

scipy.special for orthogonal polynomials (special) for Gaussian quadrature roots and weights for other weighting factors and regions.

Solving initial value problems for ODE systems

The solvers are implemented as individual classes, which can be used directly (low-level usage) or through a convenience function.

solve_ivp(fun, t_span, y0[, method, t_eval, …])

Solve an initial value problem for a system of ODEs.

RK23(fun, t0, y0, t_bound[, max_step, rtol, …])

Explicit Runge-Kutta method of order 3(2).

RK45(fun, t0, y0, t_bound[, max_step, rtol, …])

Explicit Runge-Kutta method of order 5(4).

DOP853(fun, t0, y0, t_bound[, max_step, …])

Explicit Runge-Kutta method of order 8.

Radau(fun, t0, y0, t_bound[, max_step, …])

Implicit Runge-Kutta method of Radau IIA family of order 5.

BDF(fun, t0, y0, t_bound[, max_step, rtol, …])

Implicit method based on backward-differentiation formulas.

LSODA(fun, t0, y0, t_bound[, first_step, …])

Adams/BDF method with automatic stiffness detection and switching.

OdeSolver(fun, t0, y0, t_bound, vectorized)

Base class for ODE solvers.

DenseOutput(t_old, t)

Base class for local interpolant over step made by an ODE solver.

OdeSolution(ts, interpolants)

Continuous ODE solution.

Old API

These are the routines developed earlier for SciPy. They wrap older solvers implemented in Fortran (mostly ODEPACK). While the interface to them is not particularly convenient and certain features are missing compared to the new API, the solvers themselves are of good quality and work fast as compiled Fortran code. In some cases, it might be worth using this old API.

odeint(func, y0, t[, args, Dfun, col_deriv, …])

Integrate a system of ordinary differential equations.

ode(f[, jac])

A generic interface class to numeric integrators.

complex_ode(f[, jac])

A wrapper of ode for complex systems.

Solving boundary value problems for ODE systems

solve_bvp(fun, bc, x, y[, p, S, fun_jac, …])

Solve a boundary value problem for a system of ODEs.