D01ANF calculates an approximation to the sine or the cosine transform of a function
g over
a,b:
(for a user-specified value of
ω).
SUBROUTINE D01ANF ( |
G, A, B, OMEGA, KEY, EPSABS, EPSREL, RESULT, ABSERR, W, LW, IW, LIW, IFAIL) |
INTEGER |
KEY, LW, IW(LIW), LIW, IFAIL |
REAL (KIND=nag_wp) |
G, A, B, OMEGA, EPSABS, EPSREL, RESULT, ABSERR, W(LW) |
EXTERNAL |
G |
|
D01ANF is based on the QUADPACK routine QFOUR (see
Piessens et al. (1983)). It is an adaptive routine, designed to integrate a function of the form
gxwx, where
wx is either
sinωx or
cosωx. If a sub-interval has length
then the integration over this sub-interval is performed by means of a modified Clenshaw–Curtis procedure (see
Piessens and Branders (1975)) if
Lω>4 and
l≤20. In this case a Chebyshev series approximation of degree
24 is used to approximate
gx, while an error estimate is computed from this approximation together with that obtained using Chebyshev series of degree
12. If the above conditions do not hold then Gauss
7-point and Kronrod
15-point rules are used. The algorithm, described in
Piessens et al. (1983), incorporates a global acceptance criterion (as defined in
Malcolm and Simpson (1976)) together with the
ε-algorithm (see
Wynn (1956)) to perform extrapolation. The local error estimation is described in
Piessens et al. (1983).
Malcolm M A and Simpson R B (1976) Local versus global strategies for adaptive quadrature
ACM Trans. Math. Software 1 129–146
Piessens R and Branders M (1975) Algorithm 002: computation of oscillating integrals
J. Comput. Appl. Math. 1 153–164
Piessens R, de Doncker–Kapenga E, Überhuber C and Kahaner D (1983)
QUADPACK, A Subroutine Package for Automatic Integration Springer–Verlag
Wynn P (1956) On a device for computing the
emSn transformation
Math. Tables Aids Comput. 10 91–96
If on entry
IFAIL=0 or
-1, explanatory error messages are output on the current error message unit (as defined by
X04AAF).
D01ANF cannot guarantee, but in practice usually achieves, the following accuracy:
where
and
EPSABS and
EPSREL are user-specified absolute and relative tolerances. Moreover, it returns the quantity
ABSERR which in normal circumstances, satisfies
The time taken by D01ANF depends on the integrand and the accuracy required.
If
IFAIL≠0 on exit, then you may wish to examine the contents of the array
W, which contains the end points of the sub-intervals used by D01ANF along with the integral contributions and error estimates over these sub-intervals.
Specifically, for
i=1,2,…,n, let
ri denote the approximation to the value of the integral over the sub-interval
ai,bi in the partition of
a,b and
ei be the corresponding absolute error estimate. Then,
∫aibigxwxdx≃ri and
RESULT=∑i=1nri unless D01ANF terminates while testing for divergence of the integral (see Section 3.4.3 of
Piessens et al. (1983)). In this case,
RESULT (and
ABSERR) are taken to be the values returned from the extrapolation process. The value of
n is returned in
IW1,
and the values
ai,
bi,
ei and
ri are stored consecutively in the
array
W,
that is:
- ai=Wi,
- bi=Wn+i,
- ei=W2n+i and
- ri=W3n+i.
None.