Skip to main content

Crate lib_jsl_integration

Crate lib_jsl_integration 

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

MethodModuleBest for
Trapezoid, Simpson, midpointtrapezoidal_integration_engine, simpsons_1_3_integration_engine, midpoint_integration_engineteaching; periodic integrands (trapezoid)
Rombergrombergsmooth integrands, cheap function evaluations
Gauss-Legendre, -Hermite, -Laguerregaussian_quadraturesmooth integrands, expensive evaluations, weighted and infinite intervals
Adaptive Gauss-Kronrod, adaptive trapezoidadaptive_gl7k15_integration_engine, adaptive_trapezoid_integration_engineintegrands with localised features
Tanh-sinhtanh_sinhendpoint singularities
Complex contour integralscomplex_path_integralsanalytic 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] with g(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) dz of 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, following scipy.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 of 2ᵏ + 1 equally 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): oscillatory cos ωx and sin ωx on 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.