@arki/math/integrate
For @arki/[email protected] · source docs/modules/integrate.md
Back to the README.
@arki/math/integrate
Adaptive Gauss-Kronrod and tanh-sinh integration, with infinite intervals. Every result carries an error estimate, and a method that misses its tolerance throws an IntegrationConvergenceError holding its best estimate (.best). A function that returns NaN or Infinity throws NumericRangeError naming the point.
import { integrate } from '@arki/math/integrate';
integrate(x => Math.exp(-x * x), [0, Infinity]).value; // 0.886226925452758 √π/2
integrate(x => 1 / Math.sqrt(x), [0, 1], { method: 'tanhSinh' }).value; // 2 endpoint singularity