Alexandria 2.31.0
SDC-CH common library for the Euclid project
|
#include <SimpsonsRule.h>
Public Member Functions | |
double | operator() (const Function &function, double min, double max, int order) |
Integrate a function between min and max using a mesh of 2^order steps. order>=3. | |
double | operator() (const Function &function, double min, double max, double previous_value, int order) |
Static Public Attributes | |
static const int | minimal_order = 3 |
Implement numerical integration (quadrature) based on the fit of a polynom of degree 3 on 4 successive points. For polynome of degree 3 the integration is exact even at low order. The formula is taken from "Numerical Recipes" (Third edition) W.H.Press, S.A.Teukolsky, A.T. Vetterling & B.P. Flannery. p160 Equ 4.1.14. With a shift in the notation N-1 -> N. As we use N = 2^m where we call m the order. One may compute the approximation at order = m+1 by adding only the missing terms and thus deducting by ~2 the computational cost. Note that at order m there is (2^m)+1 evaluations of the function for the direct case and (2^(m-1))+4 in the case where the result of the previous order is provided.
Definition at line 48 of file SimpsonsRule.h.
double Euclid::MathUtils::SimpsonsRule::operator() | ( | const Function & | function, |
double | min, | ||
double | max, | ||
double | previous_value, | ||
int | order | ||
) |
@detail Integrate a function between min and max using a mesh of 2^order steps based on the value at the previous order (order>=4) by adding only the difference between the integrals.
function | the R-valued function to be integrated. |
min | the lower bound of the integration domain |
max | the upper bound of the integration domain |
order | the order of the approximation. The mesh used to compute the integration will have 2^order steps. |
previous_value | The value of the integration at the previous order. |
Definition at line 52 of file SimpsonsRule.cpp.
double Euclid::MathUtils::SimpsonsRule::operator() | ( | const Function & | function, |
double | min, | ||
double | max, | ||
int | order | ||
) |
Integrate a function between min and max using a mesh of 2^order steps. order>=3.
function | the R-valued function to be integrated. |
min | the lower bound of the integration domain |
max | the upper bound of the integration domain |
order | the order of the approximation. The mesh used to compute the integration will have 2^order steps. |
Definition at line 32 of file SimpsonsRule.cpp.
Definition at line 51 of file SimpsonsRule.h.
Referenced by Euclid::PhysicsUtils::CosmologicalDistances::comovingDistance().