QNC79(3)

SYNOPSIS
SUBROUTINE QNC79 (FUN, A, B, ERR, ANS, IERR, K)

NAME
qnc79 - Integrate a function using a 7-point adaptive Newton-Cotes quadrature rule.

LIBRARY
SLATEC

CATEGORY
H2A1A1

TYPE
SINGLE PRECISION (QNC79-S, DQNC79-D)

KEYWORDS
ADAPTIVE QUADRATURE, INTEGRATION, NEWTON-COTES

AUTHOR
Kahaner, D. K., (NBS) Jones, R. E., (SNLA)

DESCRIPTION
Abstract QNC79 is a general purpose program for evaluation of one dimensional integrals of user defined functions. QNC79 will pick its own points for evaluation of the integrand and these will vary from problem to problem. Thus, QNC79 is not designed to integrate over data sets. Moderately smooth integrands will be integrated efficiently and reliably. For problems with strong singularities, oscillations etc., the user may wish to use more sophis- ticated routines such as those in QUADPACK. One measure of the reliability of QNC79 is the output parameter K, giving the number of integrand evaluations that were needed. Description of Arguments --Input-- FUN - name of external function to be integrated. This name must be in an EXTERNAL statement in your calling program. You must write a Fortran function to evaluate FUN. This should be of the form REAL FUNCTION FUN (X) C X can vary from A to B C FUN(X) should be finite for all X on interval. FUN = ... RETURN END A - lower limit of integration B - upper limit of integration (may be less than A) ERR - is a requested error tolerance. Normally, pick a value 0 .LT. ERR .LT. 1.0E-3. --Output-- ANS - computed value of the integral. Hopefully, ANS is accurate to within ERR * integral of ABS(FUN(X)). IERR - a status code - Normal codes 1 ANS most likely meets requested error tolerance. -1 A equals B, or A and B are too nearly equal to allow normal integration. ANS is set to zero. - Abnormal code 2 ANS probably does not meet requested error tolerance. K - the number of function evaluations actually used to do the integration. A value of K .GT. 1000 indicates a difficult problem; other programs may be more efficient. QNC79 will gracefully give up if K exceeds 2000.

REFERENCES
(NONE)

ROUTINES CALLED
I1MACH, R1MACH, XERMSG

REVISION HISTORY (YYMMDD)
790601 DATE WRITTEN
890531 Changed all specific intrinsics to generic. (WRB)
890531 REVISION DATE from Version 3.2
891214 Prologue converted to Version 4.0 format. (BAB)
900315 CALLs to XERROR changed to CALLs to XERMSG. (THJ)
920218 Code and prologue polished. (WRB)