Function Integrate-Qagi

Part of:

package lisplab
( integrate-qagi < f > < infinity > &key (bound 0.0d0) (epsabs 0.0d0) (epsrel 1.d-5) (limit 200) )
Compute the infinite integral of f(x):

b
/
[
I f(x) dx
]
/
a

where a and/or b may be infinite.

f - function subprogram defining the integrand
function f(x).

infinity - indicating the kind of integration range involved
:pos-infinity corresponds to (bound,+infinity),
:neg-infinity to (-infinity,bound),
:infinite 2 to (-infinity,+infinity).

bound - finite bound of integration range
(has no meaning if interval is doubly-infinite)

epsabs - double precision
absolute accuracy requested
epsrel - double precision
relative accuracy requested
if epsabs.le.0
and epsrel.lt.max(50*rel.mach.acc.,0.5d-28),
the routine will end with ier = 6.

limit - dimensioning parameter for iwork
limit determines the maximum number of subintervals
in the partition of the given integration interval
(a,b), limit.ge.1.
if limit.lt.1, the routine will end with ier = 6.

RETURN
result - double precision
approximation to the integral

ier - integer
ier = 0 normal and reliable termination of the
routine. it is assumed that the requested
accuracy has been achieved.
- ier.gt.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.
abserr - double precision
estimate of the modulus of the absolute error,
which should equal or exceed abs(i-result)

neval - integer
number of integrand evaluations

last - on return, last equals the number of
subintervals produced in the subdivision process,
which determines the significant number of
elements actually in the work arrays.
ERROR MESSAGES
ier = 1 maximum number of subdivisions allowed
has been achieved. one can allow more
subdivisions by increasing the value of
limit (and taking the according dimension
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 behaviour 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
(epsabs.le.0 and
epsrel.lt.max(50*rel.mach.acc.,0.5d-28))
or limit.lt.1 or leniw.lt.limit*4.
result, abserr, neval, last are set to
zero. exept when limit or leniw is
invalid, iwork(1), work(limit*2+1) and
work(limit*3+1) are set to zero, work(1)
is set to a and work(limit+1) to b.