Skip to content

num::adaptive_simpson

Defined in header <quadrature/quadrature.hpp>

template <typename Float = double, std::invocable<Float> Func = scalar_fn>
Float adaptive_simpson(Func &&f, Float a, Float b, Float tol = Float{1e-8},
                       idx max_depth = 50);

Adaptive Simpson quadrature with recursive interval bisection and error control.

Automatically concentrates function evaluations in regions of high curvature.

Template parameters

  • Float: Floating point scalar type.
  • Func: Integrand callable.

Parameters

  • f: Integrand function.
  • a: Lower limit.
  • b: Upper limit.
  • tol: Error tolerance for adaptive refinement (default: 1e-8).
  • max_depth: Maximum recursion depth before termination (default: 50).

Return value

High-accuracy integral approximation satisfying error tolerance.