Tanh-sinh quadrature
Tanh-sinh quadrature is a method for numerical integration introduced by Hidetoshi Takahashi and Masatake Mori in 1974.[1] It is especially applied where singularities or infinite derivatives exist at one or both endpoints.
The method uses hyperbolic functions in the change of variables
to transform an integral on the interval x ∈ (−1, 1) to an integral on the entire real line t ∈ (−∞, ∞), the two integrals having the same value. 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 , the integral is approximated by the sum
with the abscissas
and the weights
Use
The Tanh-Sinh method is quite insensitive to endpoint behavior. Should singularities or infinite derivatives exist at one or both endpoints of the (−1, 1) interval, these are mapped to the (−∞,∞) endpoints of the transformed interval, forcing the endpoint singularities and infinite derivatives to vanish. This results in a great enhancement of the accuracy of the numerical integration procedure, which is typically performed by the Trapezoidal rule. In most cases, the transformed integrand displays a rapid roll-off (decay), enabling the numerical integrator to quickly achieve convergence.
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. However, Tanh-Sinh quadrature is not as efficient as 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 as already noted. Furthermore, Tanh-Sinh quadrature can be implemented in a progressive manner, with the step size halved each time the rule level is raised, and reusing the function values calculated on previous levels. A further advantage is that the abscissas and weights are relatively simple 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.
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 presented at RNC5 on Real Numbers and Computers (Sept 2003), when 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."
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 (2006) found that: "The Tanh-Sinh quadrature scheme is the fastest currently known high-precision quadrature scheme, particularly when one counts the time for computing abscissas and weights. It has been successfully employed for quadrature calculations of up to 20,000-digit precision."
In summary, the Tanh-Sinh quadrature scheme is designed so that it gives the most accurate result for the minimum number of function evaluations. In practice, the Tanh-Sinh quadrature rule is almost invariably the best rule and is often the only effective rule when extended precision results are sought.
Implementations
- Tanh-sinh, exp-sinh, and sinh-sinh quadrature are implemented in the C++ library Boost[3]
- Tanh-sinh quadrature is implemented in a macro-enabled Excel spreadsheet by Graeme Dennes.[4]
- Tanh-sinh quadrature is implemented in the Haskell package integration.[5]
- Tanh-sinh quadrature is implemented in the Python library mpmath.[6]
- An effective implementation of Tanh-sinh quadrature in C# by Ned Ganchovski.[7]
Notes
- Takahashi & Mori (1974)
- Mori (2005)
- Thompson, Nick; Maddock, John. "Double-exponential quadrature". boost.org.
- Dennes, Graeme. "Numerical Integration With Tanh-Sinh Quadrature". Newton Excel Bach, not (just) an Excel Blog.
- Kmett, Edward. "integration: Fast robust numeric integration via tanh-sinh quadrature". Hackage.
- "mpmath library for real and complex floating-point arithmetic with arbitrary precision". mpmath.
- Ganchovski, Ned. "Tanh-Sinh Integration with C#". GitHub repository.
References
- Bailey, David H, "Tanh-Sinh High-Precision Quadrature". (2006).
- Molin, Pascal, Intégration numérique et calculs de fonctions L (in French), doctoral thesis (2010).
- Bailey, David H, Karthik Jeyabalan, and Xiaoye S. Li, "A comparison of three high-precision quadrature schemes". Experimental Mathematics, 14.3 (2005).
- Bailey, David H, Jonathan M. Borwein, David Broadhurst, and Wadim Zudlin, Experimental mathematics and mathematical physics, in Gems in Experimental Mathematics (2010), American Mathematical Society, pp. 41–58.
- Jonathan Borwein, David H. Bailey, and Roland Girgensohn, Experimentation in Mathematics—Computational Paths to Discovery. A K Peters, 2003. ISBN 1-56881-136-5.
- Mori, Masatake; Sugihara, Masaaki (15 January 2001). "The double-exponential transformation in numerical analysis". Journal of Computational and Applied Mathematics. 127 (1–2): 287–296. doi:10.1016/S0377-0427(00)00501-X. ISSN 0377-0427.
- Mori, Masatake (2005), "Discovery of the Double Exponential Transformation and Its Developments", Publications of the Research Institute for Mathematical Sciences, 41 (4): 897–935, doi:10.2977/prims/1145474600, ISSN 0034-5318. This paper is also available from here.
- Press, WH; Teukolsky, SA; Vetterling, WT; Flannery, BP (2007), "Section 4.5. Quadrature by Variable Transformation", Numerical Recipes: The Art of Scientific Computing (3rd ed.), New York: Cambridge University Press, ISBN 978-0-521-88068-8
- Takahashi, Hidetoshi; Mori, Masatake (1974), "Double Exponential Formulas for Numerical Integration", Publications of the Research Institute for Mathematical Sciences, 9 (3): 721–741, doi:10.2977/prims/1195192451, ISSN 0034-5318. This paper is also available from here.
External links
- Cook, John D, "Double Exponential Integration" with source code.
- Dennes, Graeme, "Numerical Integration With Tanh-Sinh Quadrature" A Microsoft Excel workbook containing fourteen quadrature programs which demonstrate the Tanh-Sinh and other quadrature methods. Demonstrates the astounding speed and accuracy of the Tanh-Sinh method in particular and the Double Exponential methods in general. The quadrature programs are exercised using a wide, diverse range of test integrals with results. Full open VBA source code and documentation is provided.
- van Engelen, Robert A, "Improving the Double Exponential Quadrature Tanh-Sinh, Sinh-Sinh and Exp-Sinh Formulas" compares Tanh-Sinh implementations and introduces optimizations to improve Tanh-Sinh convergence speed and accuracy. Includes Tanh-Sinh, Sinh-Sinh and Exp-Sinh methods with source code.