Skip to content

tanh_sinh integral is re-scaled internally but the tolerance isn't #449

Description

@bbbales2

The convergence criteria for the tanh_sinh quadratures looks like error < tol * L1 (https://github.com/boostorg/math/blob/develop/include/boost/math/quadrature/detail/tanh_sinh_detail.hpp#L377).

The problem is that depending on the endpoints of the integral, error and L1 are scaled differently than the actual result. For instance, here's a rescaling if both endpoints are finite:

result_type Q = diff*m_imp->integrate(u, error, L1, function, left_min_complement, right_min_complement, tolerance, levels);

if (L1) {
  *L1 *= diff;
}

There's a different one here.

So whenever I run a quadrature, if I want to check if it is converged, I cannot just double check error < tol * L1 like the docs say (https://www.boost.org/doc/libs/1_74_0/libs/math/doc/html/math_toolkit/double_exponential/de_levels.html), I gotta check error < tol * L1 * scaling, where scaling is the internal rescaling of the integrals.

It would be nice if the convergence check was all in the units of the user-facing integral. I don't know what other quadratures this applies to, just hit it on tanh_sinh.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions