D05 Chapter Contents
D05 Chapter Introduction
NAG Library Manual

NAG Library Routine DocumentD05BWF

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

D05BWF computes the quadrature weights associated with the Adams methods of orders three to six and the Backward Differentiation Formulae (BDF) methods of orders two to five. These rules, which are referred to as reducible quadrature rules, can then be used in the solution of Volterra integral and integro-differential equations.

2  Specification

 SUBROUTINE D05BWF ( METHOD, IORDER, OMEGA, NOMG, LENSW, SW, LDSW, NWT, IFAIL)
 INTEGER IORDER, NOMG, LENSW, LDSW, NWT, IFAIL REAL (KIND=nag_wp) OMEGA(NOMG), SW(LDSW,NWT) CHARACTER(1) METHOD

3  Description

D05BWF computes the weights ${W}_{i,j}$ and ${\omega }_{i}$ for a family of quadrature rules related to the Adams methods of orders three to six and the BDF methods of orders two to five, for approximating the integral:
 $∫0t ϕs ds ≃h ∑ j=0 p-1 Wi,j ϕj×h + h ∑ j=p i ωi-j ϕj×h , 0≤t≤T ,$ (1)
with $t=\mathit{i}×h$, for $\mathit{i}=0,1,\dots ,\mathit{n}$, for some given constant $h$.
In (1), $h$ is a uniform mesh, $\mathit{p}$ is related to the order of the method being used and ${W}_{i,j}$, ${\omega }_{i}$ are the starting and the convolution weights respectively. The mesh size $h$ is determined as $h=\frac{T}{\mathit{n}}$, where $\mathit{n}={\mathit{n}}_{w}+\mathit{p}-1$ and ${\mathit{n}}_{w}$ is the chosen number of convolution weights ${w}_{j}$, for $\mathit{j}=1,2,\dots ,{\mathit{n}}_{w}-1$. A description of how these weights can be used in the solution of a Volterra integral equation of the second kind is given in Section 8. For a general discussion of these methods, see Wolkenfelt (1982) for more details.

4  References

Lambert J D (1973) Computational Methods in Ordinary Differential Equations John Wiley
Wolkenfelt P H M (1982) The construction of reducible quadrature rules for Volterra integral and integro-differential equations IMA J. Numer. Anal. 2 131–152

5  Parameters

1:     METHOD – CHARACTER(1)Input
On entry: the type of method to be used.
${\mathbf{METHOD}}=\text{'A'}$
${\mathbf{METHOD}}=\text{'B'}$
For Backward Differentiation Formulae.
Constraint: ${\mathbf{METHOD}}=\text{'A'}$ or $\text{'B'}$.
2:     IORDER – INTEGERInput
On entry: the order of the method to be used. The number of starting weights, $\mathit{p}$ is determined by METHOD and IORDER.
If ${\mathbf{METHOD}}=\text{'A'}$, $\mathit{p}={\mathbf{IORDER}}-1$.
If ${\mathbf{METHOD}}=\text{'B'}$, $\mathit{p}={\mathbf{IORDER}}$.
Constraints:
• if ${\mathbf{METHOD}}=\text{'A'}$, $3\le {\mathbf{IORDER}}\le 6$;
• if ${\mathbf{METHOD}}=\text{'B'}$, $2\le {\mathbf{IORDER}}\le 5$.
3:     OMEGA(NOMG) – REAL (KIND=nag_wp) arrayOutput
On exit: contains the first NOMG convolution weights.
4:     NOMG – INTEGERInput
On entry: the number of convolution weights, ${\mathit{n}}_{w}$.
Constraint: ${\mathbf{NOMG}}\ge 1$.
5:     LENSW – INTEGEROutput
On exit: the number of rows in the weights ${W}_{i,j}$.
6:     SW(LDSW,NWT) – REAL (KIND=nag_wp) arrayOutput
On exit: ${\mathbf{SW}}\left(\mathit{i},\mathit{j}+1\right)$ contains the weights ${W}_{\mathit{i},\mathit{j}}$, for $\mathit{i}=1,2,\dots ,{\mathbf{LENSW}}$ and $\mathit{j}=0,1,\dots ,{\mathbf{NWT}}-1$, where $\mathit{n}$ is as defined in Section 3.
7:     LDSW – INTEGERInput
On entry: the first dimension of the array SW as declared in the (sub)program from which D05BWF is called.
Constraints:
• if ${\mathbf{METHOD}}=\text{'A'}$, ${\mathbf{LDSW}}\ge {\mathbf{NOMG}}+{\mathbf{IORDER}}-2$;
• if ${\mathbf{METHOD}}=\text{'B'}$, ${\mathbf{LDSW}}\ge {\mathbf{NOMG}}+{\mathbf{IORDER}}-1$.
8:     NWT – INTEGERInput
On entry: $\mathit{p}$, the number of columns in the starting weights.
Constraints:
• if ${\mathbf{METHOD}}=\text{'A'}$, ${\mathbf{NWT}}={\mathbf{IORDER}}-1$;
• if ${\mathbf{METHOD}}=\text{'B'}$, ${\mathbf{NWT}}={\mathbf{IORDER}}$.
9:     IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to $0$, $-1\text{​ or ​}1$. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value $-1\text{​ or ​}1$ is recommended. If the output of error messages is undesirable, then the value $1$ is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is $0$. When the value $-\mathbf{1}\text{​ or ​}\mathbf{1}$ is used it is essential to test the value of IFAIL on exit.
On exit: ${\mathbf{IFAIL}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).

6  Error Indicators and Warnings

If on entry ${\mathbf{IFAIL}}={\mathbf{0}}$ or $-{\mathbf{1}}$, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
${\mathbf{IFAIL}}=1$
 On entry, ${\mathbf{METHOD}}\ne \text{'A'}$ or $\text{'B'}$.
${\mathbf{IFAIL}}=2$
 On entry, ${\mathbf{IORDER}}<2$ or ${\mathbf{IORDER}}>6$, or ${\mathbf{NOMG}}<1$.
${\mathbf{IFAIL}}=3$
 On entry, ${\mathbf{METHOD}}=\text{'A'}$ and ${\mathbf{IORDER}}=2$, or ${\mathbf{METHOD}}=\text{'B'}$ and ${\mathbf{IORDER}}=6$.
${\mathbf{IFAIL}}=4$
 On entry, ${\mathbf{METHOD}}=\text{'A'}$ and ${\mathbf{NWT}}\ne {\mathbf{IORDER}}-1$, or ${\mathbf{METHOD}}=\text{'B'}$ and ${\mathbf{NWT}}\ne {\mathbf{IORDER}}$.
${\mathbf{IFAIL}}=5$
 On entry, ${\mathbf{METHOD}}=\text{'A'}$ and ${\mathbf{LDSW}}<{\mathbf{NOMG}}+{\mathbf{IORDER}}-2$, or ${\mathbf{METHOD}}=\text{'B'}$ and ${\mathbf{LDSW}}<{\mathbf{NOMG}}+{\mathbf{IORDER}}-1$.

7  Accuracy

Not applicable.

Reducible quadrature rules are most appropriate for solving Volterra integral equations (and integro-differential equations). In this section, we propose the following algorithm which you may find useful in solving a linear Volterra integral equation of the form
 $yt=ft+∫0tKt,sysds, 0≤t≤T,$ (2)
using D05BWF. In (2), $K\left(t,s\right)$ and $f\left(t\right)$ are given and the solution $y\left(t\right)$ is sought on a uniform mesh of size $h$ such that $T=\mathit{n}h$. Discretization of (2) yields
 $yi=fi×h+h∑j=0 p-1Wi,jKi,h,j,hyj+h∑j=piωi-jKi,h,j,hyj,$ (3)
where ${y}_{i}\simeq y\left(i×h\right)$. We propose the following algorithm for computing ${y}_{i}$ from (3) after a call to D05BWF:
(a) Equation (3) requires starting values, ${y}_{\mathit{j}}$, for $\mathit{j}=1,2,\dots ,{\mathbf{NWT}}-1$, with ${y}_{0}=f\left(0\right)$. These starting values can be computed by solving the linear system
 $yi = fi×h + h ∑ j=0 NWT-1 SWij+1 K i,h,j,h yj , i=1,2,…,NWT-1 .$
(b) Compute the inhomogeneous terms
 $σi = fi×h + h ∑ j= 0 NWT-1 SWij+1 Ki,h,j,h yj , i=NWT,NWT+ 1,…,n .$
(c) Start the iteration for $i={\mathbf{NWT}},{\mathbf{NWT}}+1,\dots ,\mathit{n}$ to compute ${y}_{i}$ from:
 $1 - h × OMEGA1 K i,h,i,h y i = σ i + h ∑ j = NWT i - 1 OMEGA i - j + 1 K i,h,j,h y j .$
Note that for a nonlinear integral equation, the solution of a nonlinear algebraic system is required at step (a) and a single nonlinear equation at step (c).

9  Example

The following example generates the first ten convolution and thirteen starting weights generated by the fourth-order BDF method.

9.1  Program Text

Program Text (d05bwfe.f90)

None.

9.3  Program Results

Program Results (d05bwfe.r)