NAG FL Interface
d01bdf (dim1_​fin_​smooth)

Settings help

FL Name Style:


FL Specification Language:


1 Purpose

d01bdf calculates an approximation to the integral of a function over a finite interval [a,b]:
I= ab f(x) 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 [a,b], or which oscillate too strongly on [a,b].

2 Specification

Fortran Interface
Subroutine d01bdf ( f, a, b, epsabs, epsrel, result, abserr)
Real (Kind=nag_wp), External :: f
Real (Kind=nag_wp), Intent (In) :: a, b, epsabs, epsrel
Real (Kind=nag_wp), Intent (Out) :: result, abserr
C Header Interface
#include <nag.h>
void  d01bdf_ (
double (NAG_CALL *f)(const double *x),
const double *a, const double *b, const double *epsabs, const double *epsrel, double *result, double *abserr)
The routine may be called by the names d01bdf or nagf_quad_dim1_fin_smooth.

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 Arguments

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:
Fortran Interface
Function f ( x)
Real (Kind=nag_wp) :: f
Real (Kind=nag_wp), Intent (In) :: x
C Header Interface
double  f (const double *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. Arguments denoted as Input must not be changed by this procedure.
Note: f should not return floating-point NaN (Not a Number) or infinity values, since these are not handled by d01bdf. If your code inadvertently does return any NaNs or infinities, d01bdf is likely to produce unexpected results.
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<b.
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 |I-result|.

6 Error Indicators and Warnings

There are no specific errors detected by d01bdf. However, if abserr is greater than
max{epsabs,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 |I-result|.

8 Parallelism and Performance

Background information to multithreading can be found in the Multithreading documentation.
d01bdf is not threaded in any implementation.

9 Further Comments

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

10 Example

This example computes
0 1 x2 sin(10πx) dx .  

10.1 Program Text

Program Text (d01bdfe.f90)

10.2 Program Data

None.

10.3 Program Results

Program Results (d01bdfe.r)