Function integrateQAWC

Calculate a Cauchy principal value integral.

Result!Real integrateQAWC(Func, Real) (
  scope Func f,
  Real a,
  Real b,
  Real c,
  Real epsRel = cast(Real)1e-06,
  Real epsAbs = cast(Real)0
);

Use this to calculate the integral of f(x)/(x-c) over the finite interval (a,b), where f(x) is smooth on the entire interval and c is not one of the endpoints.

The strategy is globally adaptive. Modified Clenshaw–Curtis integration is used on those intervals containing the point x = c.

Example

// Integrate cos(x-1)/(x-1) over the interval (0,3)
real f(real x) { return cos(x-1); }
auto i = integrateQAWC(&f, 0.0L, 3.0L, 1.0L, 1e-15L);