Function integrateQNG
Calculate the integral of f(x)
over the finite interval (a
,b
)
using a simple
non-adaptive automatic integrator, based on a sequence of rules with
increasing degree of algebraic precision.
Result!Real integrateQNG(Func, Real)
(
scope Func f,
Real a,
Real b,
Real epsRel = cast(Real)1e-06,
Real epsAbs = cast(Real)0
);
This method should only be used for well-behaved integrands, or when speed is a lot more important than accuracy.
Example
// Despite the statement above, integrateQNG() can handle some
// difficulties, such as the endpoint singularity in the following
// example:
double f(double x) { return x^^2 * log(1/x); }
auto i = integrateQNG(&f, 0.0, 1.0);