TANH_QUAD
A Rapidly Converging Quadrature Rule.


TANH_QUAD is a MATLAB library which sets up the tanh quadrature scheme and related rules.

These schemes typically have two parameters, N the (truncated) order, and H, a discretization size. To construct a family of quadrature rules, it is typical to ensure that H goes to zero as N goes to infinity. Sometimes this is done by fixing the value of the product N*H, and sometimes in other ways.

The tanh quadrature scheme approximates the integral

        Integral ( -1 <= X <= 1 ) F(X) dx
      
by
        Sum ( -N <= I <= N ) W(i) * F ( X(i) )
      
where Kahaner, Moler and Nash suggest choosing N freely, and then taking H as
        H = pi * sqrt ( 2 / N ) - ( 1 / N ).
      
and
        X(i) = tanh(i*H/2)
      
and
        W(i) = H / 2 / cosh(I*H/2) / cosh(I*H/2)
      

This rule has some unusual properties. In particular, it is not exact for any polynomial; it can't even integrate the function f(x)=1 exactly. But while it is not exact, it can be highly accurate, that is, for relatively low values of N and for a wide range of integrals, the estimate will have a very low error, and as N increases, the error can decrease exponentially.

The tanh-sinh quadrature scheme approximates the integral

        Integral ( -1 <= X <= 1 ) F(X) dx
      
by
        Sum ( -N <= I <= N ) W(i) * F ( X(i) )
      
where Bailey suggests parameterizing by an integer M, with
        N = 8 * 2^M,
        H = 1 / 2^M,
        N * H = 8.
      
and
        Ti = i * H,
        X(i) = tanh(pi/2*sinh(Ti))
      
and
        W(i) = H * ( pi / 2 ) * cosh(Ti) / cosh^2(pi/2*sinh(Ti))
      

Quadrature rules can be transformed from the [-1,1] interval to the interval [a,b] by using the rule_adjust routine.

Licensing:

The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.

Languages:

TANH_QUAD is available in a C++ version and a FORTRAN90 version and a MATLAB version.

Related Data and Programs:

CHEBYSHEV1_RULE, a MATLAB program which can compute and print a Gauss-Chebyshev type 1 quadrature rule.

CHEBYSHEV2_RULE, a MATLAB program which can compute and print a Gauss-Chebyshev type 2 quadrature rule.

GEGENBAUER_RULE, a MATLAB program which can compute and print a Gauss-Gegenbauer quadrature rule.

GEN_HERMITE_RULE, a MATLAB program which can compute and print a generalized Gauss-Hermite quadrature rule.

GEN_LAGUERRE_RULE, a MATLAB program which can compute and print a generalized Gauss-Laguerre quadrature rule.

HERMITE_RULE, a MATLAB program which can compute and print a Gauss-Hermite quadrature rule.

INT_EXACTNESS, a MATLAB program which checks the polynomial exactness of a 1-dimensional quadrature rule for a finite interval.

INTLIB, a FORTRAN90 library which contains a variety of routines for numerical estimation of integrals in 1D.

JACOBI_RULE, a MATLAB program which can compute and print a Gauss-Jacobi quadrature rule.

LAGUERRE_RULE, a MATLAB program which can compute and print a Gauss-Laguerre quadrature rule.

LEGENDRE_RULE, a MATLAB program which computes a Gauss-Legendre quadrature rule.

QUADRULE, a MATLAB library which defines quadrature rules for 1D domains.

QUADPACK, a FORTRAN90 library which contains a variety of routines for numerical estimation of integrals in 1D.

QUADRATURE_RULES, a dataset directory which contains sets of files that define quadrature rules over various 1D intervals or multidimensional hypercubes.

TEST_INT, a FORTRAN90 library which contains a number of functions that may be used as test integrands for quadrature rules in 1D.

TEST_INT_2D, a MATLAB library which defines test integrands for 2D quadrature rules.

Reference:

  1. David Bailey, Jonathan Borwein,
    Experimental Mathematics: Examples, Methods and Implications,
    Notices of the American Mathematical Society,
    Volume 52, Number 5, pages 502-514.
  2. David Bailey, Karthik Jeyabalan, Xiaoye Li,
    A Comparison of Three High-Precision Quadrature Schemes,
    Experimental Mathematics,
    Volume 14, Number 3, pages 317-329.
  3. David Kahaner, Cleve Moler, Steven Nash,
    Numerical Methods and Software,
    Prentice Hall, 1989,
    ISBN: 0-13-627258-4,
    LC: TA345.K34.
  4. Charles Schwartz,
    Numerical Integration of Analytic Functions,
    Journal of Computational Physics,
    Volume 4, Number 1, June 1969, pages 19-29.
  5. William Squire,
    An Eficient Iterative Method for Numerical Evaluation of Integrals Over a Semi-infinite Range,
    International Journal for Numerical Methods in Engineering,
    Volume 10, Number 2, 1976, pages 478-484.
  6. William Squire,
    A Quadrature Method for Finite Intervals,
    International Journal for Numerical Methods in Engineering,
    Volume 10, Number 3, 1976, pages 708-712.
  7. William Squire,
    In Defense of Linear Quadrature Rules,
    Computers and Mathematics with Applications,
    Volume 7, Number 2, 1981, pages 147-149.

Source Code:

Examples and Tests:

You can go up one level to the MATLAB source codes.


Last revised on 09 January 2009.