qage Subroutine

public subroutine qage(f, a, b, epsabs, epsrel, key, limit, result, abserr, neval, ier, alist, blist, rlist, elist, iord, last)

QAGE estimates a definite integral.

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|| ).

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.

Input, integer LIMIT, the maximum number of subintervals that can be used.

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.

Workspace, real ALIST(LIMIT), BLIST(LIMIT), contains in entries 1 through LAST the left and right ends of the partition subintervals.

Workspace, real RLIST(LIMIT), contains in entries 1 through LAST the integral approximations on the subintervals.

Workspace, real ELIST(LIMIT), contains in entries 1 through LAST the absolute error estimates on the subintervals.

Output, integer IORD(LIMIT), the first K elements of which are pointers to the error estimates over the subintervals, such that elist(iord(1)), ..., elist(iord(k)) form a decreasing sequence, with k = last if last <= (limit/2+2), and k = limit+1-last otherwise.

Output, integer LAST, the number of subintervals actually produced in the subdivision process.

Local parameters:

alist - list of left end points of all subintervals considered up to now blist - list of right end points of all subintervals considered up to now elist(i) - error estimate applying to rlist(i) maxerr - pointer to the interval with largest error estimate errmax - elist(maxerr) area - sum of the integrals over the subintervals errsum - sum of the errors over the subintervals errbnd - requested accuracy max(epsabs,epsrelabs(result)) *1 - variable for the left subinterval **2 - variable for the right subinterval last - index for subdivision

Arguments

Type IntentOptional Attributes Name
procedure(scalar_func) :: f
real :: a
real :: b
real :: epsabs
real :: epsrel
integer :: key
integer :: limit
real :: result
real :: abserr
integer :: neval
integer :: ier
real :: alist(limit)
real :: blist(limit)
real :: rlist(limit)
real :: elist(limit)
integer :: iord(limit)
integer :: last

Contents