Next: D104 Cauchy Principal Up: CERNLIB Previous: D102 Adaptive Gaussian

Routine ID: D103
Author(s): K.S. KölbigLibrary: MATHLIB
Submitter: Submitted: 02.05.1966
Language: FortranRevised: 15.03.1993

Function subprograms GAUSS, DGAUSS and QGAUSS compute, to an attempted specified accuracy, the value of the integral

$I=\int$ABf(x)dx.

The quadruple-precision version QGAUSS is available only on computers which support a REAL*16 Fortran data type.

Structure:

FUNCTION subprograms
User Entry Names: GAUSS, DGAUSS, QGAUSS
Files Referenced: Unit 6
External References: MTLMTR (N002), ABEND (Z035), user-supplied FUNCTION subprogram

Usage:

In any arithmetic expression, GAUSS(F,A,B,EPS), DGAUSS(F,A,B,EPS) or QGAUSS(F,A,B,EPS)

has the approximate value of the integral I.

F
Name of a user-supplied FUNCTION subprogram, declared EXTERNAL in the calling program. This subprogram must set $F\left(X\right)= f\left(X\right)$ .
A,B
End-points of integration interval. Note that B may be less than A.
EPS
Accuracy parameter (see Accuracy).
GAUSS is of type REAL, DGAUSS is of type DOUBLE PRECISION, QGAUSS is of type REAL*16, and the arguments F, A, B, EPS and X (in F) have the same type as the function name.

Method:

For any interval $\left[a,b\right]$ we define $g$8(a,b) and $g$16(a,b) to be the 8-point and 16-point Gaussian quadrature approximations to

$\int$abf(x)dx

and define

$r\left(a,b\right) =\left\{|g$16(a,b) - g8(a,b)|1+|g16(a,b)|}.

Then, with G = GAUSS or DGAUSS,

$G =\sum$i=1kg16(xi-1,xi),

where, starting with $x$0=A and finishing with $x$k=B , the subdivision points $x$i (i=1,2,...) are given by

$x$i= xi-1+ λ(B-xi-1),

with $\lambda$ equal to the first member of the sequence $1,\left\{12\right\},\left\{14\right\},...$ for which $r\left(x$i-1,xi) < EPS . If, at any stage in the process of subdivision, the ratio

$q=|\left\{x$i-xi-1B-A}|

is so small that $1+0.005q$ is indistinguishable from 1 to machine accuracy, an error exit occurs with the function value set equal to zero.

Accuracy:

Unless there is severe cancellation of positive and negative values of $f\left(x\right)$ over the interval $\left[A,B\right]$ , the argument EPS may be considered as specifying a bound on the relative error of I in the case |I|>1, and a bound on the absolute error in the case |I|<1. More precisely, if k is the number of sub-intervals contributing to the approximation (see Method), and if

$I$abs= ∫AB|f(x)|dx,

then the relation

$\left\{|G - I|I$abs+k}< EPS

will nearly always be true, provided the routine terminates without printing an error message. For functions f having no singularities in the closed interval $\left[A,B\right]$

the accuracy will usually be much higher than this.

Error handling:

Error D103.1: The requested accuracy cannot be obtained (see Method). The function value is set equal to zero, and a message is written on Unit 6 unless subroutine MTLSET (N002) has been called.

Notes:

Values of the function $f\left(x\right)$ at the interval end-points A and B are not required. The subprogram may therefore be used when these values are undefined.
$•$

Next: D104 Cauchy Principal Up: CERNLIB Previous: D102 Adaptive Gaussian

Janne Saarela
Mon Apr 3 15:06:23 METDST 1995