qag Subroutine

public subroutine qag(f, a, b, epsabs, epsrel, key, result, abserr, neval, ier)

QAG approximates an integral over a finite interval.

Discussion:

The routine calculates an approximation RESULT to a definite integral
I = integral of F over (A,B), hopefully satisfying || I - RESULT || <= max ( EPSABS, EPSREL * ||I|| ).

QAG is a simple globally adaptive integrator using the strategy of Aind (Piessens, 1973). It is possible to choose between 6 pairs of Gauss-Kronrod quadrature formulae for the rule evaluation component. The pairs of high degree of precision are suitable for handling integration difficulties due to a strongly oscillating integrand.

Author:

Robert Piessens, Elise de Doncker-Kapenger, Christian Ueberhuber, David Kahaner

Reference:

Robert Piessens, Elise de Doncker-Kapenger, Christian Ueberhuber, David Kahaner, QUADPACK, a Subroutine Package for Automatic Integration, Springer Verlag, 1983

Parameters:

Input, external real F, the name of the function routine, of the form function f ( x ) real f real x which evaluates the integrand function.

Input, real A, B, the limits of integration.

Input, real EPSABS, EPSREL, the absolute and relative accuracy requested.

Input, integer KEY, chooses the order of the local integration rule: 1, 7 Gauss points, 15 Gauss-Kronrod points, 2, 10 Gauss points, 21 Gauss-Kronrod points, 3, 15 Gauss points, 31 Gauss-Kronrod points, 4, 20 Gauss points, 41 Gauss-Kronrod points, 5, 25 Gauss points, 51 Gauss-Kronrod points, 6, 30 Gauss points, 61 Gauss-Kronrod points.

Output, real RESULT, the estimated value of the integral.

Output, real ABSERR, an estimate of || I - RESULT ||.

Output, integer NEVAL, the number of times the integral was evaluated.

Output, integer IER, return code. 0, normal and reliable termination of the routine. It is assumed that the requested accuracy has been achieved. 1, maximum number of subdivisions allowed has been achieved. One can allow more subdivisions by increasing the value of LIMIT in QAG. However, if this yields no improvement it is advised to analyze the integrand to determine the integration difficulties. If the position of a local difficulty can be determined, such as a singularity or discontinuity within the interval) one will probably gain from splitting up the interval at this point and calling the integrator on the subranges. If possible, an appropriate special-purpose integrator should be used which is designed for handling the type of difficulty involved. 2, the occurrence of roundoff error is detected, which prevents the requested tolerance from being achieved. 3, extremely bad integrand behavior occurs at some points of the integration interval. 6, the input is invalid, because EPSABS < 0 and EPSREL < 0.

Local parameters:

LIMIT is the maximum number of subintervals allowed in the subdivision process of QAGE.

Arguments

Type IntentOptional Attributes Name
procedure(scalar_func) :: f
real :: a
real :: b
real :: epsabs
real :: epsrel
integer :: key
real :: result
real :: abserr
integer :: neval
integer :: ier

Contents