next up previous index
Next: D103 Adaptive Gaussian Up: CERNLIB Previous: D101 Integration by

D102 Adaptive Gaussian Quadrature

Routine ID: D102
Author(s): F. JamesLibrary: MATHLIB
Submitter: Submitted: 01.12.1994
Language: FortranRevised:

Subroutine subprograms RADAPT and DADAPT calculate, to an attempted specified accuracy, the value of the integral

I = ∫abf(x) dx

by adaptive subdivision of the interval (a,b) , calculating the integrals over the subintervals using RGS56P and DGS56P (D106).

On CDC and Cray computers, the double-precision version DADAPT is not available.

Structure:

SUBROUTINE subprograms
User Entry Names: RADAPT, DADAPT
External References: RGS56P, DGS56P (D106), user-supplied FUNCTION subprogram.

Usage:

For t=R (type REAL), t=D (type DOUBLE PRECISION),

    CALL tADAPT(F,A,B,NSEG,RELTOL,ABSTOL,RES,ERR)
F
(type according to t) Name of a user-supplied FUNCTION subprogram, declared EXTERNAL in the calling program. This subprogram must set F(X)= f(X) .
A,B
(type according to t) End-points of integration interval. Note that B may be less than A.
NSEG
( INTEGER) Specifies how the adaptation is to be done:
= 0: use the subdivisions as determined in the previous call to tADAPT,
= 1: fully automatic, adapt until tolerance attained,
= n>1: first split interval into n equal segments, then adapt as necessary to attain tolerance.
RELTOL
(type according to t) Specified relative tolerance.
ABSTOL
(type according to t) Specified absolute tolerance.
The calculation comes to an end if either RELTOL or ABSTOL is satisfied, or the number of segments exceeds 100. Either RELTOL or ABSTOL can be set to zero, in which case only the other is used.
RES
(type according to t) The calculated approximation for I.
ERR
(type according to t) An estimated absolute uncertainty on this approximation.

Method:

The automatic adaption is done as follows: At each step, the total integral is estimated as the sum of the integrals over the subdivisions, and the squared uncertainty is estimated as the sum of the squares of the uncertainties over all subdivisions. If this uncertainty is too big (failing both the absolute and relative tolerance criteria) then the subinterval with the largest absolute uncertainty is divided in half.

Accuracy:

The true accuracy is usually very close to the uncertainty returned by the subroutine, sometimes it is much better, but very seldom worse. Even on functions with (integrable) singularities, the results are usually reliable, as long as the singularity is ``wide enough'' to be detected in the early stages, which can be controlled by the value of NSEG.

D103



next up previous index
Next: D103 Adaptive Gaussian Up: CERNLIB Previous: D101 Integration by


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