Integral: Numerical resolution of definite integrals
|
|
Numerical definite integration of a series of points.
Integration schemes included are:
|
TRAPEZOIDAL
|
Trapezoidal integration
|
SIMPSON_1_3
|
Simpson's 1/3 rule with a correction if the number of points is even.
|
SIMPSON_3_8
|
Simpson's 3/8 rule with a correction if the number of points is not a multiple of three.
|
HERMITE_3
|
Hermite's rule with a three points difference scheme to approximate endpoints derivatives.
|
HERMITE_5
|
Hermite's rule with a five points difference scheme to approximate endpoints derivatives.
|
SPLINE
|
Integral obtained by interpolation with a natural spline
|
|
In addition, an implementation of the Filon quadrature is included.
References:
Wikipedia Simpson's rule
"An Invitation to Hermite’s Integration and Summation: A Comparison between Hermite’s and Simpson’s Rules", V. Lampret. SIAM REVIEW Vol. 46, No. 2, pp. 311–328 (2004)
"Hermite versus Simpson: the Geometry of Numerical Integration", Andy Long and Cliff Long., (2010)
Wikipedia Filon quadrature
"An algorithm for Filon quadrature"
template <class Range, class T> T Integral(const Range &x, const Range &y, IntegralType type = TRAPEZOIDAL)
Obtains the numerical integration of data series defined by points (x, y), using the integration schema defined with type.
template <class Range, class T> T Integral(const Range &y, T dx, IntegralType type = TRAPEZOIDAL)
Obtains the numerical integration of data series defined by points y, separated dx between them, using the integration schema defined with type.
template <Range> typename Range::value_type IntegralSinCos(typename Range::value_type xfrom, typename Range::value_type dx, const Range& f, typename Range::value_type t, bool iscos)
Obtains the numerical integration of data series from xfrom, equidistant separated dx, and whose y is, depending on iscos flag:
iscos is true: f·cos(x·t)
iscos is false: f·sin(x·t)
It uses Filon quadrature.
|