# QuantLib_TrapezoidIntegral man page

TrapezoidIntegral< IntegrationPolicy > — Integral of a one-dimensional function.

## Synopsis

`#include <ql/math/integrals/trapezoidintegral.hpp>`

Inherits Integrator.

### Public Member Functions

TrapezoidIntegral(Realaccuracy,SizemaxIterations)

### Protected Member Functions

Real integrate(const boost::function<Real(Real)> &f,Reala,Realb) const

## Detailed Description

### template<class IntegrationPolicy>

class QuantLib::TrapezoidIntegral< IntegrationPolicy >" Integral of a one-dimensional function.

Given a target accuracy $ \psilon $, the integral of a function $ f $ between $ a $ and $ b $ is calculated by means of the trapezoid formula [ int_{a}^{b} f mathrm{d}x = ac{1}{2} f(x_{0}) + f(x_{1}) + f(x_{2}) + ots + f(x_{N-1}) + ac{1}{2} f(x_{N}) ] where $ x_0 = a $, $ x_N = b $, and $ x_i = a+i Delta x $ with $ Delta x = (b-a)/N $. The number $ N $ of intervals is repeatedly increased until the target accuracy is reached.

**Tests**

the correctness of the result is tested by checking it against known good values.

## Author

Generated automatically by Doxygen for QuantLib from the source code.

## Referenced By

TrapezoidIntegral(3) is an alias of QuantLib_TrapezoidIntegral(3).