D01 Chapter Contents
D01 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentD01BDF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

## 1  Purpose

D01BDF calculates an approximation to the integral of a function over a finite interval $\left[a,b\right]$:
 $I= ∫ab fx dx .$
It is non-adaptive and as such is recommended for the integration of ‘smooth’ functions. These exclude integrands with singularities, derivative singularities or high peaks on $\left[a,b\right]$, or which oscillate too strongly on $\left[a,b\right]$.

## 2  Specification

 SUBROUTINE D01BDF ( F, A, B, EPSABS, EPSREL, RESULT, ABSERR)
 REAL (KIND=nag_wp) F, A, B, EPSABS, EPSREL, RESULT, ABSERR EXTERNAL F

## 3  Description

D01BDF is based on the QUADPACK routine QNG (see Piessens et al. (1983)). It is a non-adaptive routine which uses as its basic rules, the Gauss $10$-point and $21$-point formulae. If the accuracy criterion is not met, formulae using $43$ and $87$ points are used successively, stopping whenever the accuracy criterion is satisfied.
This routine is designed for smooth integrands only.

## 4  References

Patterson T N L (1968) The Optimum addition of points to quadrature formulae Math. Comput. 22 847–856
Piessens R, de Doncker–Kapenga E, Überhuber C and Kahaner D (1983) QUADPACK, A Subroutine Package for Automatic Integration Springer–Verlag

## 5  Parameters

1:     F – REAL (KIND=nag_wp) FUNCTION, supplied by the user.External Procedure
F must return the value of the integrand $f$ at a given point.
The specification of F is:
 FUNCTION F ( X)
 REAL (KIND=nag_wp) F
 REAL (KIND=nag_wp) X
1:     X – REAL (KIND=nag_wp)Input
On entry: the point at which the integrand $f$ must be evaluated.
F must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which D01BDF is called. Parameters denoted as Input must not be changed by this procedure.
2:     A – REAL (KIND=nag_wp)Input
On entry: $a$, the lower limit of integration.
3:     B – REAL (KIND=nag_wp)Input
On entry: $b$, the upper limit of integration. It is not necessary that $a.
4:     EPSABS – REAL (KIND=nag_wp)Input
On entry: the absolute accuracy required. If EPSABS is negative, the absolute value is used. See Section 7.
5:     EPSREL – REAL (KIND=nag_wp)Input
On entry: the relative accuracy required. If EPSREL is negative, the absolute value is used. See Section 7.
6:     RESULT – REAL (KIND=nag_wp)Output
On exit: the approximation to the integral $I$.
7:     ABSERR – REAL (KIND=nag_wp)Output
On exit: an estimate of the modulus of the absolute error, which should be an upper bound for $\left|I-{\mathbf{RESULT}}\right|$.

## 6  Error Indicators and Warnings

There are no specific errors detected by D01BDF. However, if ABSERR is greater than
 $maxEPSABS,EPSREL×RESULT$
this indicates that the routine has probably failed to achieve the requested accuracy within $87$ function evaluations.

## 7  Accuracy

D01BDF attempts to compute an approximation, RESULT, such that:
 $I-RESULT ≤ tol ,$
where
 $tol = max EPSABS , EPSREL × I ,$
and EPSABS and EPSREL are user-specified absolute and relative error tolerances. There can be no guarantee that this is achieved, and you are advised to subdivide the interval if you have any doubts about the accuracy obtained. Note that ABSERR contains an estimated bound on $\left|I-{\mathbf{RESULT}}\right|$.

The time taken by D01BDF depends on the integrand and the accuracy required.

## 9  Example

This example computes
 $∫ 0 1 x2 sin10πx dx .$

### 9.1  Program Text

Program Text (d01bdfe.f90)

None.

### 9.3  Program Results

Program Results (d01bdfe.r)