HERMITE_TEST_INT
Quadrature Tests for Infinite Intervals
HERMITE_TEST_INT
is a C++ library which
defines integration problems over infinite intervals of the form (-oo,+oo).
The test integrands would normally be used to testing one
dimensional quadrature software. It is possible to invoke a
particular function by index, or to try out all available functions,
as demonstrated in the sample calling program.
For a given integrand function f(x), the problem is to estimate
I(f) = integral ( -oo < x < +oo ) w(x) * f(x) dx
We consider three variations of the problem, depending on the
form of the weight factor w(x):
-
option = 0, the unweighted integral:
Integral ( -oo < x < +oo ) f(x) dx
-
option = 1, the physicist weighted integral:
Integral ( -oo < x < +oo ) exp(-x*x) f(x) dx
-
option = 2, the probabilist weighted integral:
Integral ( -oo < x < +oo ) exp(-x*x/2) f(x) dx
For option 0, the test integrands have the form:
-
f1(x) = exp(-x*x) * cos(2*omega*x);
-
f2(x) = exp(-x*x);
-
f3(x) = exp(-px)/(1+exp(-qx));
-
f4(x) = sin ( x^2 );
-
f5(x) = 1 / (1+x^2) sqrt (4+3x^2) );
-
f6(x) = exp(-x*x) * x^m;
-
f7(x) = x^2 cos(x) exp(-x*x);
-
f8(x) = sqrt ( 1 + x * x / 2 ) * exp(-x*x/2);
For option 1, the test integrands have the form:
-
f1(x) = cos(2*omega*x);
-
f2(x) = 1
-
f3(x) = exp(x*x) * exp(-px)/(1+exp(-qx));
-
f4(x) = exp(x*x) * sin ( x^2 );
-
f5(x) = exp(x*x) * 1 / (1+x^2) sqrt (4+3x^2) );
-
f6(x) = x^m;
-
f7(x) = x^2 cos(x);
-
f8(x) = sqrt ( 1 + x * x / 2 ) * exp(+x*x/2);
For option 2, the test integrands have the form:
-
f1(x) = exp(-x*x/2) * cos(2*omega*x);
-
f2(x) = exp(-x*x/2);
-
f3(x) = exp(+x*x/2) * exp(-px)/(1+exp(-qx));
-
f4(x) = exp(+x*x/2) * sin ( x^2 );
-
f5(x) = exp(+x*x/2) * 1 / (1+x^2) sqrt (4+3x^2) );
-
f6(x) = exp(-x*x/2) * x^m;
-
f7(x) = x^2 cos(x) exp(-x*x/2);
-
f8(x) = sqrt ( 1 + x * x / 2 );
The library includes not just the integrand, but also the exact value
of the integral (or, typically, an estimate of this value), and
a title for the problem.
Thus, for each integrand function, several routines are supplied. For
instance, for function #1, we have the routines:
-
P01_FUN evaluates the integrand for problem 1.
-
P01_EXACT returns the estimated integral for problem 1.
-
P01_TITLE returns a title for problem 1.
So once you have the calling sequences for these routines, you
can easily evaluate the function, or integrate it on the
appropriate interval, or compare your estimate of the integral
to the exact value.
Moreover, since the same interface is used for each function,
if you wish to work with problem 5 instead, you simply change
the "01" to "05" in your routine calls.
If you wish to call all of the functions, then you
simply use the generic interface, which requires you to specify
the problem number as an extra input argument:
-
P00_FUN evaluates the integrand for any problem.
-
P00_EXACT returns the exact integral for any problem.
-
P00_TITLE returns a title for any problem.
Some demonstration routines are built in for simple quadrature methods:
-
P00_GAUSS_HERMITE uses a Gauss-Hermite quadrature formula;
-
P00_MONTE_CARLO uses a Monte Carlo scheme, with
sample points selected according to the standard
normal probability distribution;
-
P00_TURING applies a simple equally spaced method of
Turing.
Licensing:
The computer code and data files described and made available on this web page
are distributed under
the GNU LGPL license.
Languages:
HERMITE_TEST_INT is available in
a C version and
a C++ version and
a FORTRAN77 version and
a FORTRAN90 version and
a MATLAB version.
Related Data and Programs:
HERMITE_EXACTNESS,
a C++ program which
tests the polynomial exactness of Gauss-Hermite quadrature rules.
HERMITE_RULE,
a C++ program which
can compute and print a Gauss-Hermite quadrature rule.
LAGUERRE_TEST_INT,
a C++ library which
defines test integrands for quadrature rules
for estimating the integral of a function with density exp(-x)
over the interval [0,+oo).
QUADRATURE_RULES_HERMITE_PHYSICIST,
a dataset directory which
contains Gauss-Hermite quadrature rules, for integration
on the interval (-oo,+oo), with weight function exp(-x^2).
QUADRATURE_RULES_HERMITE_PROBABILIST,
a dataset directory which
contains Gauss-Hermite quadrature rules, for integration
on the interval (-oo,+oo), with weight function exp(-x^2/2).
QUADRATURE_RULES_HERMITE_UNWEIGHTED,
a dataset directory which
contains Gauss-Hermite quadrature rules, for integration
on the interval (-oo,+oo), with weight function 1.
TEST_INT,
a C++ library which
defines test integrands for 1D quadrature rules.
TEST_INT_2D,
a C++ library which
defines test integrands for 2D quadrature rules.
Reference:
-
Philip Davis, Philip Rabinowitz,
Methods of Numerical Integration,
Second Edition,
Dover, 2007,
ISBN: 0486453391,
LC: QA299.3.D28.
-
Prem Kythe, Michael Schaeferkotter,
Handbook of Computational Methods for Integration,
Chapman and Hall, 2004,
ISBN: 1-58488-428-2,
LC: QA299.3.K98.
-
Robert Piessens, Elise deDoncker-Kapenga,
Christian Ueberhuber, David Kahaner,
QUADPACK: A Subroutine Package for Automatic Integration,
Springer, 1983,
ISBN: 3540125531,
LC: QA299.3.Q36.
-
William Squire,
Comparison of Gauss-Hermite and Midpoint Quadrature with Application
to the Voigt Function,
in Numerical Integration:
Recent Developments, Software and Applications,
edited by Patrick Keast, Graeme Fairweather,
Reidel, 1987, pages 337-340,
ISBN: 9027725144,
LC: QA299.3.N38.
-
Arthur Stroud, Don Secrest,
Gaussian Quadrature Formulas,
Prentice Hall, 1966,
LC: QA299.4G3S7.
-
Alan Turing,
A Method for the Calculation of the Zeta Function,
Proceedings of the London Mathematical Society,
Volume 48, 1943, pages 180-197.
Source Code:
Examples and Tests:
List of Routines:
-
HERMITE_COMPUTE computes a Gauss-Hermite quadrature rule.
-
HERMITE_INTEGRAL returns the value of a Hermite polynomial integral.
-
HERMITE_RECUR finds the value and derivative of a Hermite polynomial.
-
HERMITE_ROOT improves an approximate root of a Hermite polynomial.
-
I4_FACTORIAL2 computes the double factorial function.
-
P00_EXACT returns the exact integral for any problem.
-
P00_FUN evaluates the integrand for any problem.
-
P00_GAUSS_HERMITE applies a Gauss-Hermite quadrature rule.
-
P00_MONTE_CARLO applies a Monte Carlo procedure to Hermite integrals.
-
P00_PROBLEM_NUM returns the number of test integration problems.
-
P00_TITLE returns the title for any problem.
-
P00_TURING applies the Turing quadrature rule.
-
P01_EXACT returns the exact integral for problem 1.
-
P01_FUN evaluates the integrand for problem 1.
-
P01_TITLE returns the title for problem 1.
-
P02_EXACT returns the exact integral for problem 2.
-
P02_FUN evaluates the integrand for problem 2.
-
P02_TITLE returns the title for problem 2.
-
P03_EXACT returns the exact integral for problem 3.
-
P03_FUN evaluates the integrand for problem 3.
-
P03_TITLE returns the title for problem 3.
-
P04_EXACT returns the estimated integral for problem 4.
-
P04_FUN evaluates the integrand for problem 4.
-
P04_TITLE returns the title for problem 4.
-
P05_EXACT returns the estimated integral for problem 5.
-
P05_FUN evaluates the integrand for problem 5.
-
P05_TITLE returns the title for problem 5.
-
P06_EXACT returns the exact integral for problem 6.
-
P06_FUN evaluates the integrand for problem 6.
-
P06_PARAM gets or sets parameters for problem 6.
-
P06_TITLE returns the title for problem 6.
-
P07_EXACT returns the exact integral for problem 7.
-
P07_FUN evaluates the integrand for problem 7.
-
P07_TITLE returns the title for problem 7.
-
P08_EXACT returns the exact integral for problem 8.
-
P08_FUN evaluates the integrand for problem 8.
-
P08_TITLE returns the title for problem 8.
-
R8_ABS returns the absolute value of an R8.
-
R8_EPSILON returns the R8 roundoff unit.
-
R8_GAMMA evaluates Gamma(X) for a real argument.
-
R8_HUGE returns a "huge" R8.
-
R8VEC_DOT_PRODUCT computes the dot product of a pair of R8VEC's.
-
R8VEC_NORMAL_01_NEW returns a unit pseudonormal R8VEC.
-
R8VEC_REVERSE reverses the elements of an R8VEC.
-
R8VEC_SUM returns the sum of an R8VEC.
-
R8VEC_UNIFORM_01_NEW returns a new unit pseudorandom R8VEC.
-
TIMESTAMP prints the current YMDHMS date as a time stamp.
You can go up one level to
the C++ source codes.
Last revised on 31 July 2010.