- QuantLib
- TrapezoidIntegral
 
Integral of a one-dimensional function. More...
#include <ql/math/integrals/trapezoidintegral.hpp>
Inherits Integrator.
| Public Member Functions | |
| TrapezoidIntegral (Real accuracy, Size maxIterations) | |
| Protected Member Functions | |
| Real | integrate (const boost::function< Real(Real)> &f, Real a, Real b) const | 
Integral of a one-dimensional function.
Given a target accuracy  , the integral of a function
, the integral of a function  between
 between  and
 and  is calculated by means of the trapezoid formula
 is calculated by means of the trapezoid formula 
![\[ \int_{a}^{b} f \mathrm{d}x = \frac{1}{2} f(x_{0}) + f(x_{1}) + f(x_{2}) + \dots + f(x_{N-1}) + \frac{1}{2} f(x_{N}) \]](form_204.png) 
 where  ,
,  , and
, and  with
 with  . The number
. The number  of intervals is repeatedly increased until the target accuracy is reached.
 of intervals is repeatedly increased until the target accuracy is reached.