Tanh-sinh quadrature is a method for numerical integration introduced by Hidetosi Takahasi and Masatake Mori in 1974.[1] It uses hyperbolic functions in the change of variables

${\displaystyle x=\tanh({\tfrac {1}{2}}\pi \sinh t)\,}$

to transform an integral on the interval x ∈ (−1, +1) to an integral on the entire real line t ∈ (−∞,+∞). After this transformation, the integrand decays with a double exponential rate, and thus, this method is also known as the double exponential (DE) formula.[2]

For a given step size h, the integral is approximated by the sum

${\displaystyle \int _{-1}^{1}f(x)\,dx\approx \sum _{k=-\infty }^{\infty }w_{k}f(x_{k}),}$

with the abscissas

${\displaystyle x_{k}=\tanh({\tfrac {1}{2}}\pi \sinh kh)}$

and the weights

${\displaystyle w_{k}={\frac {{\tfrac {1}{2}}h\pi \cosh kh}{\cosh ^{2}({\tfrac {1}{2}}\pi \sinh kh)}}.}$

Like Gaussian quadrature, tanh-sinh quadrature is well suited for arbitrary-precision integration, where an accuracy of hundreds or even thousands of digits is desired. The convergence is exponential (in the discretization sense) for sufficiently well-behaved integrands: doubling the number of evaluation points roughly doubles the number of correct digits.

Tanh-sinh quadrature is less efficient than Gaussian quadrature for smooth integrands, but unlike Gaussian quadrature tends to work equally well with integrands having singularities or infinite derivatives at one or both endpoints of the integration interval. A further advantage is that the abscissas and weights are relatively easy to compute. The cost of calculating abscissa–weight pairs for n-digit accuracy is roughly n2 log2 n compared to n3 log n for Gaussian quadrature.

Upon comparing the scheme to Gaussian quadrature and error function quadrature, Bailey et al. (2005) found that the tanh-sinh scheme "appears to be the best for integrands of the type most often encountered in experimental math research".

Bailey and others have done extensive research on tanh-sinh quadrature, Gaussian quadrature and error function quadrature, as well as several of the classical quadrature methods, and found that the classical methods are not competitive with the first three methods, particularly when high-precision results are required. In a conference paper (July 2004) comparing tanh-sinh quadrature with Gaussian quadrature and error function quadrature, Bailey and Li found: "Overall, the tanh-sinh scheme appears to be the best. It combines uniformly excellent accuracy with fast run times. It is the nearest we have to a truly all-purpose quadrature scheme at the present time."

Bailey (2006) found that: "The tanh-sinh quadrature scheme is the fastest known high-precision quadrature scheme, especially when the time for computing abscissas and weights is considered. It has been successfully employed for quadrature calculations of up to 20,000-digit precision. It works well for functions with blow-up singularities or infinite derivatives at endpoints."

## Implementations

Tanh-sinh, exp-sinh, and sinh-sinh quadrature are implemented in the C++ library Boost[3] and a macro-enabled Excel spreadsheet by Graeme Dennes.[4]

## Notes

1. ^ Takahasi & Mori (1974)
2. ^ Mori (2005)
3. ^ Thompson, Nick; Maddock, John. "Double-exponential quadrature". boost.org.
4. ^ Dennes, Graeme (29 December 2014). "Numerical Integration; Tanh-Sinh Quadrature v4.3". Newton Excel Bach, not (just) an Excel Blog.