Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

exp_sinh

template<class Real>
class exp_sinh
{
public:
    exp_sinh(size_t max_refinements = 9);

    template<class F>
    auto integrate(const F f, Real a, Real b,
                   Real tol = sqrt(std::numeric_limits<Real>::epsilon()),
                   Real* error = nullptr,
                   Real* L1 = nullptr,
                   size_t* levels = nullptr)->decltype(std::declval<F>()(std::declval<Real>())) const;
    template<class F>
    auto integrate(const F f,
                   Real tol = sqrt(std::numeric_limits<Real>::epsilon()),
                   Real* error = nullptr,
                   Real* L1 = nullptr,
                   size_t* levels = nullptr)->decltype(std::declval<F>()(std::declval<Real>())) const;
};

For half-infinite intervals, the exp-sinh quadrature is provided:

exp_sinh<double> integrator;
auto f = [](double x) { return exp(-3*x); };
double termination = sqrt(std::numeric_limits<double>::epsilon());
double error;
double L1;
double Q = integrator.integrate(f, termination, &error, &L1);

The native integration range of this integrator is (0, ∞), but we also support (a, ∞), (-∞, 0) and (-∞, b) via argument transformations.

Endpoint singularities and complex-valued integrands are supported by exp-sinh.


PrevUpHomeNext