25#ifndef quantlib_simpson_integral_hpp
26#define quantlib_simpson_integral_hpp
46 Real I = (
f(a)+
f(
b))*(
b-a)/2.0, newI;
49 Real adjI = I, newAdjI;
56 newAdjI = (4.0*newI-I)/3.0;
66 QL_FAIL(
"max number of iterations reached");
Real absoluteAccuracy() const
Size maxEvaluations() const
void increaseNumberOfEvaluations(Size increase) const
Integral of a one-dimensional function.
SimpsonIntegral(Real accuracy, Size maxIterations)
Real integrate(const ext::function< Real(Real)> &f, Real a, Real b) const override
Integral of a one-dimensional function.
#define QL_FAIL(message)
throw an error (possibly with file and line information)
ext::function< Real(Real)> b
std::size_t Size
size of a container
static Real integrate(const ext::function< Real(Real)> &f, Real a, Real b, Real I, Size N)
integral of a one-dimensional function using the trapezoid formula