Expand description
Numerical integration: quadrature in one and many dimensions, ordinary differential equations, boundary value problems and partial differential equations.
The companion book explains how and why each method works, with derivations, history and figures: https://jwkunz.github.io/lib_jsl/book/integration/index.html.
§Quadrature in one dimension
Most engines implement can_integrate::CanIntegrate1D.
| Method | Module | Best for |
|---|---|---|
| Trapezoid, Simpson, midpoint | trapezoidal_integration_engine, simpsons_1_3_integration_engine, midpoint_integration_engine | teaching; periodic integrands (trapezoid) |
| Romberg | romberg | smooth integrands, cheap function evaluations |
| Gauss-Legendre, -Hermite, -Laguerre | gaussian_quadrature | smooth integrands, expensive evaluations, weighted and infinite intervals |
| Adaptive Gauss-Kronrod, adaptive trapezoid | adaptive_gl7k15_integration_engine, adaptive_trapezoid_integration_engine | integrands with localised features |
| Tanh-sinh | tanh_sinh | endpoint singularities |
| Complex contour integrals | complex_path_integrals | analytic functions along paths |
§Many dimensions
cubature (adaptive Genz-Malik and tensor Gauss rules) for up to about ten dimensions;
monte_carlo_integration and quasi_monte_carlo beyond.
§Differential equations
runge_kutta_4::rk4_solve (fixed step) and dormand_prince::dormand_prince_solve
(adaptive) for non-stiff initial value problems y' = f(t, y),
stiff_ode (Rosenbrock and BDF) for stiff ones, boundary_value_problems (shooting and
collocation), and pde (finite difference, finite element and spectral methods).
Modules§
- adaptive_
gl7k15_ integration_ engine - Globally adaptive Gauss-Kronrod quadrature with the 7-point Gauss and 15-point Kronrod pair.
- adaptive_
trapezoid_ integration_ engine - Adaptive trapezoid quadrature.
- boundary_
value_ problems - Two-point boundary value problems
y' = f(x, y)on[a, b]withg(y(a), y(b)) = 0. - calculate_
midpoints - Sample points for the composite Newton-Cotes rules.
- can_
integrate - The common interface of the one-dimensional quadrature engines.
- complex_
path_ integrals - Contour integrals
∫ f(z) dzof complex functions along paths in the complex plane. - cubature
- Multidimensional integration over hyperrectangles: tensor-product Gauss-Legendre rules and globally adaptive Genz-Malik cubature.
- dormand_
prince - Adaptive Dormand-Prince 5(4) integration of ordinary differential equations.
- gaussian_
quadrature - Gaussian quadrature rules: Gauss-Legendre, Gauss-Hermite and generalized Gauss-Laguerre.
- ivp
- Initial value problems
y' = f(t, y)with dense output and event location, followingscipy.integrate.solve_ivp: - midpoint_
integration_ engine - The composite midpoint rule.
- monte_
carlo_ integration - Plain Monte Carlo integration over boxes.
- pde
- Partial differential equations: finite difference, finite element and spectral methods.
- quad_
vec - Adaptive integration of vector-valued functions over finite or infinite intervals, a port of
SciPy’s
quad_vec: every component shares one set of subintervals, chosen by a global Gauss-Kronrod error estimate in the 2-norm (or the max norm). - quasi_
monte_ carlo - Randomized quasi-Monte Carlo integration over boxes.
- romberg
- Romberg integration.
- runge_
kutta_ 4 - The classical fourth-order Runge-Kutta method with a fixed step.
- sampled
- Integration of sampled data, following
scipy.integrate: the composite trapezoid and Simpson rules for equally or unequally spaced samples, Romberg integration of2ᵏ + 1equally spaced samples, and the cumulative trapezoid and Simpson integrals. - simpsons_
1_ 3_ integration_ engine - The composite Simpson’s 1/3 rule.
- stiff_
ode - Solvers for stiff systems of ordinary differential equations
y' = f(t, y). - tanh_
sinh - Tanh-sinh (double exponential) quadrature.
- trapezoidal_
integration_ engine - The composite trapezoid rule.
- weighted
- Integrals with a known difficult weight, the cases of SciPy’s
quad(weight=…)(QUADPACK’s QAWO, QAWF, QAWS and QAWC): oscillatorycos ωxandsin ωxon finite and semi-infinite intervals, algebraic-logarithmic endpoint singularities(x − a)^α (b − x)^β [log], and Cauchy principal values⨍ f(x)/(x − c) dx. Each uses a method suited to the weight rather than a port of QUADPACK’s modified Clenshaw-Curtis moments; the results are compared with SciPy in the book.