Skip to main content

Module definite

Module definite 

Source
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

  1. Bounds. a = b gives 0; a > b swaps the bounds and negates.
  2. Special integrands. DiracDelta, Heaviside, Abs, Sign, Piecewise, Floor/Ceiling are eliminated first by truncating or splitting the interval so that every remaining piece is smooth.
  3. 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.
  4. Breakpoints. Poles, ln zeros, tan poles, branch points of fractional powers and inverse-trig domain edges of the integrand are located with the breakpoint scanner in calculus_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.
  5. Fundamental theorem. An antiderivative F is obtained from the indefinite integrator. Its own discontinuities inside the interval (e.g. the atan(tan(x/2)) jump produced by the Weierstrass substitution) are split as well. Endpoint values are direct substitutions when F is continuous there, otherwise one-sided limits: the approach x → c⁺ is rewritten as x = c + 1/u, u → +∞ (and x = c − 1/u for c⁻), 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.
  6. Divergence. An infinite one-sided limit of F proves divergence. Without an antiderivative, comparison with 1/(x − c) (or 1/x at 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§

QuadOpts
Options for quadrature and Ex::integrate_numeric_with.

Functions§

integrate_definite
Compute the definite integral ∫ₐᵇ f dx on the arena.
quadrature
Adaptive Gauss–Kronrod quadrature of f over [a, b].