SpECTRE  v2024.04.12
integration::GslQuadAdaptive< TheIntegralType > Class Template Reference

A wrapper around the GSL adaptive integration procedures. More...

Detailed Description

template<GslIntegralType TheIntegralType>
class integration::GslQuadAdaptive< TheIntegralType >

A wrapper around the GSL adaptive integration procedures.

All templates take upper bounds to the absolute and relative error; tolerance_abs and tolerance_rel(default = 0.0), respectively. To compute to a specified absolute error, set tolerance_rel to zero. To compute to a specified relative error, set tolerance_abs to zero. For details on the algorithm see the GSL documentation on gsl_integration.

Here is an example how to use this class. For the function:

double gaussian(const double x, const double mean, const double factor) {
return 2. * factor / sqrt(M_PI) * exp(-square(x - mean));
}
T exp(T... args)
constexpr decltype(auto) square(const T &x)
Compute the square of x
Definition: ConstantExpressions.hpp:55
auto sqrt(const TensorExpression< T, X, Symm, IndexList, tmpl::list< Args... > > &t)
Returns the tensor expression representing the square root of a tensor expression that evaluates to a...
Definition: SquareRoot.hpp:253

the integration should look like:

const double mean = 5.;
const double factor = 2.;
const double lower_boundary = -4.;
const double upper_boundary = 10.;
const auto result = integration(
[&mean, &factor](const double x) { return gaussian(x, mean, factor); },
lower_boundary, upper_boundary, absolute_tolerance, 4);
A wrapper around the GSL adaptive integration procedures.
Definition: GslQuadAdaptive.hpp:109
Numerical integration algorithms.
Definition: GslQuadAdaptive.hpp:19
@ StandardGaussKronrod
gsl_integration_qag()

The documentation for this class was generated from the following file: