Expand description
Definite and improper integration. Definite and improper integration: singularity checks, limits at endpoints, known-value tables.
The entry point is integrate_definite, which computes
∫ₐᵇ f(x) dx without ever returning a silently wrong finite number.
Where the naive rule F(b) − F(a) would give −2 for ∫₋₁¹ dx/x²,
this module detects the interior pole, splits the interval there, and
reports SymplexError::Divergent.
§Algorithm
- Bounds.
a = bgives0;a > bswaps the bounds and negates. - Special integrands.
DiracDelta,Heaviside,Abs,Sign,Piecewise,Floor/Ceilingare eliminated first by truncating or splitting the interval so that every remaining piece is smooth. - Known-value table. Classical improper integrals (Gaussian, Gamma, Beta, Dirichlet, Wallis, Fresnel, Bose–Einstein, …) are matched structurally with symbolic parameters; any positivity conditions are checked through the assumption system and the entry is skipped when they cannot be established.
- Breakpoints. Poles,
lnzeros,tanpoles, branch points of fractional powers and inverse-trig domain edges of the integrand are located with the breakpoint scanner incalculus_util. Interior points split the interval; endpoint singularities and infinite bounds are handled as improper integrals. A numeric sign-change guard on every denominator catches zeros the symbolic solver missed; if a singularity cannot be placed relative to symbolic bounds the integral is left unevaluated rather than guessed. - Fundamental theorem. An antiderivative
Fis obtained from the indefinite integrator. Its own discontinuities inside the interval (e.g. theatan(tan(x/2))jump produced by the Weierstrass substitution) are split as well. Endpoint values are direct substitutions whenFis continuous there, otherwise one-sided limits: the approachx → c⁺is rewritten asx = c + 1/u,u → +∞(andx = c − 1/uforc⁻), so that every limit is a limit at+∞, where the Gruntz algorithm is strongest. Limits are evaluated compositionally first (using assumptions for parameters) and only then by the black-box limit engine, whose finite results are sanity-checked numerically. - Divergence. An infinite one-sided limit of
Fproves divergence. Without an antiderivative, comparison with1/(x − c)(or1/xat infinity) is attempted; if nothing can be decided the integral is returned unevaluated.
The same file also provides the adaptive Gauss–Kronrod (G7/K15)
quadrature used by Ex::integrate_numeric (quadrature, QuadOpts).
Structs§
- Quad
Opts - Options for
quadratureandEx::integrate_numeric_with.
Functions§
- integrate_
definite - Compute the definite integral
∫ₐᵇ f dxon the arena. - quadrature
- Adaptive Gauss–Kronrod quadrature of
fover[a, b].