qagi Subroutine

public subroutine qagi(f, bound, inf, epsabs, epsrel, result, abserr, neval, ier)

QAGI estimates an integral over a semi-infinite or infinite interval.

Discussion:

The routine calculates an approximation RESULT to a definite integral
I = integral of F over (A, +Infinity), or I = integral of F over (-Infinity,A) or I = integral of F over (-Infinity,+Infinity), 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 BOUND, the value of the finite endpoint of the integration range, if any, that is, if INF is 1 or -1.

Input, integer INF, indicates the type of integration range. 1: ( BOUND, +Infinity), -1: ( -Infinity, BOUND), 2: ( -Infinity, +Infinity).

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

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, error indicator. 0, normal and reliable termination of the routine. It is assumed that the requested accuracy has been achieved.

0, abnormal termination of the routine. The estimates for result and error are less reliable. It is assumed that the requested accuracy has not been achieved. 1, maximum number of subdivisions allowed has been achieved. One can allow more subdivisions by increasing the data value of LIMIT in QAGI (and taking the according dimension adjustments into account). However, if this yields no improvement it is advised to analyze the integrand in order to determine the integration difficulties. If the position of a local difficulty can be determined (e.g. singularity, 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. The error may be under-estimated. 3, extremely bad integrand behavior occurs at some points of the integration interval. 4, the algorithm does not converge. Roundoff error is detected in the extrapolation table. It is assumed that the requested tolerance cannot be achieved, and that the returned result is the best which can be obtained. 5, the integral is probably divergent, or slowly convergent. It must be noted that divergence can occur with any other value of IER. 6, the input is invalid, because INF /= 1 and INF /= -1 and INF /= 2, or epsabs < 0 and epsrel < 0. result, abserr, neval are set to zero.

Local parameters:

       the dimension of rlist2 is determined by the value of
       limexp in QEXTR.

      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
      rlist(i)  - approximation to the integral over
                  (alist(i),blist(i))
      rlist2    - array of dimension at least (limexp+2),
                  containing the part of the epsilon table
                  which is still needed for further computations
      elist(i)  - error estimate applying to rlist(i)
      maxerr    - pointer to the interval with largest error
                  estimate
      errmax    - elist(maxerr)
      erlast    - error on the interval currently subdivided
                  (before that subdivision has taken place)
      area      - sum of the integrals over the subintervals
      errsum    - sum of the errors over the subintervals
      errbnd    - requested accuracy max(epsabs,epsrel*
                  abs(result))
      *****1    - variable for the left subinterval
      *****2    - variable for the right subinterval
      last      - index for subdivision
      nres      - number of calls to the extrapolation routine
      numrl2    - number of elements currently in rlist2. if an
                  appropriate approximation to the compounded
                  integral has been obtained, it is put in
                  rlist2(numrl2) after numrl2 has been increased
                  by one.
      small     - length of the smallest interval considered up
                  to now, multiplied by 1.5
      erlarg    - sum of the errors over the intervals larger
                  than the smallest interval considered up to now
      extrap    - logical variable denoting that the routine
                  is attempting to perform extrapolation. i.e.
                  before subdividing the smallest interval we
                  try to decrease the value of erlarg.
      noext     - logical variable denoting that extrapolation
                  is no longer allowed (true-value)

Arguments

Type IntentOptional Attributes Name
procedure(scalar_func) :: f
real :: bound
integer :: inf
real :: epsabs
real :: epsrel
real :: result
real :: abserr
integer :: neval
integer :: ier

Contents