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:
-
David Bailey, Jonathan Borwein,
Experimental Mathematics: Examples, Methods and Implications,
Notices of the American Mathematical Society,
Volume 52, Number 5, pages 502-514.
-
David Bailey, Karthik Jeyabalan, Xiaoye Li,
A Comparison of Three High-Precision Quadrature Schemes,
Experimental Mathematics,
Volume 14, Number 3, pages 317-329.
-
David Kahaner, Cleve Moler, Steven Nash,
Numerical Methods and Software,
Prentice Hall, 1989,
ISBN: 0-13-627258-4,
LC: TA345.K34.
-
Charles Schwartz,
Numerical Integration of Analytic Functions,
Journal of Computational Physics,
Volume 4, Number 1, June 1969, pages 19-29.
-
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.
-
William Squire,
A Quadrature Method for Finite Intervals,
International Journal for Numerical Methods in Engineering,
Volume 10, Number 3, 1976, pages 708-712.
-
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:
-
tanh_quad_test.m,
calls all the tests.
-
tanh_quad_test_output.txt,
the output file.
-
tanh_quad_test01.m,
demonstrates TANH_M_TO_H and TANH_H_TO_N.
-
tanh_quad_test02.m,
computes a particular tanh rule.
-
tanh_quad_test025.m,
computes a particular tanh-sinh rule.
-
tanh_quad_test03.m,
computes a tanh rule based on a tolerance.
-
tanh_quad_test04.m,
uses the trapezoid rule on some test integrals.
-
tanh_quad_test05.m,
uses the tanh rule on some test integrals.
-
tanh_quad_test06.m,
uses the tanh-sinh rule on some test integrals.
-
p00_ab.m,
returns the integration limits for any test integral.
-
p00_e.m,
returns the exact integral value for any test integral.
-
p00_f.m,
evaluates the integrand for any test integral.
-
p01_ab.m,
returns the integration limits for test integral 01.
-
p01_e.m,
returns the exact integral value for test integral 01.
-
p01_f.m,
evaluates the integrand for test integral 01.
-
p02_ab.m,
returns the integration limits for test integral 02.
-
p02_e.m,
returns the exact integral value for test integral 02.
-
p02_f.m,
evaluates the integrand for test integral 02.
-
p03_ab.m,
returns the integration limits for test integral 03.
-
p03_e.m,
returns the exact integral value for test integral 03.
-
p03_f.m,
evaluates the integrand for test integral 03.
-
p04_ab.m,
returns the integration limits for test integral 04.
-
p04_e.m,
returns the exact integral value for test integral 04.
-
p04_f.m,
evaluates the integrand for test integral 04.
-
p05_ab.m,
returns the integration limits for test integral 05.
-
p05_e.m,
returns the exact integral value for test integral 05.
-
p05_f.m,
evaluates the integrand for test integral 05.
-
p06_ab.m,
returns the integration limits for test integral 06.
-
p06_e.m,
returns the exact integral value for test integral 06.
-
p06_f.m,
evaluates the integrand for test integral 06.
-
p07_ab.m,
returns the integration limits for test integral 07.
-
p07_e.m,
returns the exact integral value for test integral 07.
-
p07_f.m,
evaluates the integrand for test integral 07.
-
p08_ab.m,
returns the integration limits for test integral 08.
-
p08_e.m,
returns the exact integral value for test integral 08.
-
p08_f.m,
evaluates the integrand for test integral 08.
-
p09_ab.m,
returns the integration limits for test integral 09.
-
p09_e.m,
returns the exact integral value for test integral 09.
-
p09_f.m,
evaluates the integrand for test integral 09.
-
p10_ab.m,
returns the integration limits for test integral 10.
-
p10_e.m,
returns the exact integral value for test integral 10.
-
p10_f.m,
evaluates the integrand for test integral 10.
-
p11_ab.m,
returns the integration limits for test integral 11.
-
p11_e.m,
returns the exact integral value for test integral 11.
-
p11_f.m,
evaluates the integrand for test integral 11.
-
p12_ab.m,
returns the integration limits for test integral 12.
-
p12_e.m,
returns the exact integral value for test integral 12.
-
p12_f.m,
evaluates the integrand for test integral 12.
-
p13_ab.m,
returns the integration limits for test integral 13.
-
p13_e.m,
returns the exact integral value for test integral 13.
-
p13_f.m,
evaluates the integrand for test integral 13.
-
p14_ab.m,
returns the integration limits for test integral 14.
-
p14_e.m,
returns the exact integral value for test integral 14.
-
p14_f.m,
evaluates the integrand for test integral 14.
You can go up one level to
the MATLAB source codes.
Last revised on 09 January 2009.