### A free/open-source library for quantitative finance

Public Member Functions | Protected Member Functions
SegmentIntegral Class Reference

Integral of a one-dimensional function. More...

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

Inherits Integrator.

List of all members.

## Public Member Functions

| SegmentIntegral (Size intervals)

## Protected Member Functions

virtual Real | integrate (const boost::function< Real(Real)> &f, Real a, Real b) const

## Detailed Description

Integral of a one-dimensional function.

Given a number of intervals, the integral of a function between and is calculated by means of the trapezoid formula

where , , and with .

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