// integration on [0, inf] by DE formula auto deint = makeDEInt!real(0, real.infinity, Yes.isExpDecay); // integration on [0, inf] by DE formula with a weight exp(-x). auto weighted = deint.withWeight((real x) => exp(-x)); assert(deint.integrate((real x) => 1.0/(2*sqrt(x)) * exp(-x) ) .approxEqual(weighted.integrate((real x) => 1.0/(2*sqrt(x)) )));
This function create a instance of NumInt from original another and weight function. This function is useful when we know integrands has same weight.