Class for integration of functions with one independent parameter. More...
#include "utl/Integrator.h"
Public Member Functions | |
double | GetIntegral (const double a, const double b) const |
call this method when you do not care about the specific implementation More... | |
double | GetRombergIntegral (const double a, const double b, const int order=5, const int maxIterations=20) const |
Romberg integration Setting order to 2 is equivalent to the Simpson's method. More... | |
double | GetSimpsonIntegral (const double a, const double b, const int minLevel=4, const int maxLevel=20) const |
Simpson improvement build on top of the trapezoidal integration. More... | |
double | GetTrapezoidalIntegral (const double a, const double b, const int minLevel=4, const int maxLevel=20) const |
basic trapezoidal integration More... | |
Integrator (Functor &functor, const double accuracy=1e-5) | |
void | SetAccuracy (const double accuracy) |
final accuracy goal of the integration More... | |
Private Member Functions | |
for (int i=0;i< n;++i) | |
double | GetTrapezoidalAverage (const double previousApproximation, const double a, const double delta, const int level) const |
Calculates succsessive approximations to the function average. More... | |
Private Attributes | |
double | const |
average of a function represented with equidistant boxes More... | |
double | fAccuracy |
Functor & | fFunctor |
return sum | n |
Class for integration of functions with one independent parameter.
Example of usage:
Simple functions that do not need initialization or additional parameters can be used directly (without the functor):
Note that some built-in function do not have a static binding (like log(), exp() etc) and have to be wrapped in functor or function.
Definition at line 72 of file Integrator.h.
|
inline |
Definition at line 75 of file Integrator.h.
|
inlineprivate |
Definition at line 219 of file Integrator.h.
|
inline |
call this method when you do not care about the specific implementation
Definition at line 82 of file Integrator.h.
|
inline |
Romberg integration Setting order to 2 is equivalent to the Simpson's method.
Definition at line 89 of file Integrator.h.
Referenced by utl::Integrator< utl::MuonArrivalTime::TimePDFArg >::GetIntegral(), IntegratorTest::testSpeed(), atm::Arbeletche2021CherenkovAngularModel::UnnormalizedIntegralRight(), and atm::Arbeletche2021CherenkovAngularModel::UnnormalizedIntegralSineRight().
|
inline |
Simpson improvement build on top of the trapezoidal integration.
Definition at line 124 of file Integrator.h.
Referenced by IntegratorTest::testSpeed().
|
inlineprivate |
Calculates succsessive approximations to the function average.
previousApproximation,: | result of the level-1 call |
a,: | start of the integration interval |
delta,: | width of the integration interval (b - a) |
level,: | should be greater or equal to 1 (see point scheme below) |
The evaluation points are generated according to the following scheme:
Definition at line 203 of file Integrator.h.
Referenced by utl::Integrator< utl::MuonArrivalTime::TimePDFArg >::GetRombergIntegral(), utl::Integrator< utl::MuonArrivalTime::TimePDFArg >::GetSimpsonIntegral(), and utl::Integrator< utl::MuonArrivalTime::TimePDFArg >::GetTrapezoidalIntegral().
|
inline |
basic trapezoidal integration
Definition at line 155 of file Integrator.h.
Referenced by IntegratorTest::testSpeed().
|
inline |
final accuracy goal of the integration
Definition at line 79 of file Integrator.h.
|
private |
average of a function represented with equidistant boxes
Definition at line 217 of file Integrator.h.
|
private |
Definition at line 227 of file Integrator.h.
Referenced by utl::Integrator< utl::MuonArrivalTime::TimePDFArg >::GetRombergIntegral(), utl::Integrator< utl::MuonArrivalTime::TimePDFArg >::GetSimpsonIntegral(), utl::Integrator< utl::MuonArrivalTime::TimePDFArg >::GetTrapezoidalIntegral(), and utl::Integrator< utl::MuonArrivalTime::TimePDFArg >::SetAccuracy().
|
private |
Definition at line 226 of file Integrator.h.
Referenced by utl::Integrator< utl::MuonArrivalTime::TimePDFArg >::for().
|
private |
Definition at line 223 of file Integrator.h.
Referenced by utl::Integrator< utl::MuonArrivalTime::TimePDFArg >::GetTrapezoidalAverage().