These functions approximate the integral of a real valued function over the
entire real line, using the Gauss-Hermite Quadrature method of specified
order.
a, b, Result | Subroutine |
Short-precision real | SGHMQ |
Long-precision real | DGHMQ |
Fortran | SGHMQ | DGHMQ (subf, a, b, n) |
C and C++ | sghmq | dghmq (subf, a, b, n); |
PL/I | SGHMQ | DGHMQ (subf, a, b, n); |
Specified as: subf must be declared as an external subroutine in your application program. It can be whatever name you choose.
The integral is approximated for a real valued function over the entire real line, using the Gauss-Hermite Quadrature method of specified order. The region of integration is from -infinity to infinity. The method of order n is theoretically exact for integrals of the following form, where f is a polynomial of degree less than 2n:
The method of order n is a good approximation when your integrand is closely approximated by a function of the following form, where f is a polynomial of degree less than 2n:
See references [26] and [92]. The result is returned as the function value to a Fortran, C, C++, or PL/I program.
None
This example shows how to compute the integral of the function f given by:
over the interval (-infinity, infinity), using the Gauss-Hermite method with 4 points:
The user-supplied subroutine FUN1, which evaluates the integrand function, is coded in Fortran as follows:
SUBROUTINE FUN1 (T,Y,N) INTEGER*4 N REAL*4 T(*),Y(*) DO 1 I=1,N 1 Y(I)=T(I)**2*EXP(-2.0*(T(I)+5.0)**2) RETURN END
EXTERNAL FUN1 . . . SUBF A B N | | | | XINT = SGHMQ( FUN1 , -5.0 , 2.0 , 4 ) . . .
XINT = 31.646