Function integrateDEO

Calculate the integral of an oscillating function f(x) over the infinite interval (a,∞) using double exponential integration.

Result!Real integrateDEO(Func, Real) (
  scope Func f,
  Real a,
  Real omega,
  Real epsRel = cast(Real)1e-06
);

f(x) is assumed to take the form

f(x) = g(x) * sin(omega * x + theta)

as x goes to infinity (theta is not specified).

Example

real f(real x) { return x <= 0 ? 0 : cos(x) * exp(-x/64) / sqrt(x); }
auto i = integrateDEO(&f, 0.0L, 1.0L, 1e-18L);