D05 Chapter Contents
D05 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentD05BYF

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

D05BYF computes the fractional quadrature weights associated with the Backward Differentiation Formulae (BDF) of orders $4$, $5$ and $6$. These weights can then be used in the solution of weakly singular equations of Abel type.

## 2  Specification

 SUBROUTINE D05BYF ( IORDER, IQ, LENFW, WT, SW, LDSW, WORK, LWK, IFAIL)
 INTEGER IORDER, IQ, LENFW, LDSW, LWK, IFAIL REAL (KIND=nag_wp) WT(LENFW), SW(LDSW,2*IORDER-1), WORK(LWK)

## 3  Description

D05BYF computes the weights ${W}_{i,j}$ and ${\omega }_{i}$ for a family of quadrature rules related to a BDF method for approximating the integral:
 $1π∫0tϕs t-s ds≃h∑j=0 2p-2Wi,jϕj×h+h∑j=2p-1iωi-jϕj×h, 0≤t≤T,$ (1)
with $t=i×h\left(i\ge 0\right)$, for some given $h$. In (1), $p$ is the order of the BDF method used and ${W}_{i,j}$, ${\omega }_{i}$ are the fractional starting and the fractional convolution weights respectively. The algorithm for the generation of ${\omega }_{i}$ is based on Newton's iteration. Fast Fourier transform (FFT) techniques are used for computing these weights and subsequently ${W}_{i,j}$ (see Baker and Derakhshan (1987) and Henrici (1979) for practical details and Lubich (1986) for theoretical details). Some special functions can be represented as the fractional integrals of simpler functions and fractional quadratures can be employed for their computation (see Lubich (1986)). A description of how these weights can be used in the solution of weakly singular equations of Abel type is given in Section 8.

## 4  References

Baker C T H and Derakhshan M S (1987) Computational approximations to some power series Approximation Theory (eds L Collatz, G Meinardus and G Nürnberger) 81 11–20
Henrici P (1979) Fast Fourier methods in computational complex analysis SIAM Rev. 21 481–529
Lubich Ch (1986) Discretized fractional calculus SIAM J. Math. Anal. 17 704–719

## 5  Parameters

1:     IORDER – INTEGERInput
On entry: $p$, the order of the BDF method to be used.
Constraint: $4\le {\mathbf{IORDER}}\le 6$.
2:     IQ – INTEGERInput
On entry: determines the number of weights to be computed. By setting IQ to a value, ${2}^{{\mathbf{IQ}}+1}$ fractional convolution weights are computed.
Constraint: ${\mathbf{IQ}}\ge 0$.
3:     LENFW – INTEGERInput
On entry: the dimension of the array WT as declared in the (sub)program from which D05BYF is called.
Constraint: ${\mathbf{LENFW}}\ge {2}^{{\mathbf{IQ}}+2}$.
4:     WT(LENFW) – REAL (KIND=nag_wp) arrayOutput
On exit: the first ${2}^{{\mathbf{IQ}}+1}$ elements of WT contains the fractional convolution weights ${\omega }_{i}$, for $\mathit{i}=0,1,\dots ,{2}^{{\mathbf{IQ}}+1}-1$. The remainder of the array is used as workspace.
5:     SW(LDSW,$2×{\mathbf{IORDER}}-1$) – REAL (KIND=nag_wp) arrayOutput
On exit: ${\mathbf{SW}}\left(\mathit{i},\mathit{j}+1\right)$ contains the fractional starting weights ${W}_{\mathit{i}-1,\mathit{j}}$ , for $\mathit{i}=1,2,\dots ,\mathit{N}$ and $\mathit{j}=0,1,\dots ,2×{\mathbf{IORDER}}-2$, where $\mathit{N}=\left({2}^{{\mathbf{IQ}}+1}+2×{\mathbf{IORDER}}-1\right)$.
6:     LDSW – INTEGERInput
On entry: the first dimension of the array SW as declared in the (sub)program from which D05BYF is called.
Constraint: ${\mathbf{LDSW}}\ge {2}^{{\mathbf{IQ}}+1}+2×{\mathbf{IORDER}}-1$.
7:     WORK(LWK) – REAL (KIND=nag_wp) arrayWorkspace
8:     LWK – INTEGERInput
On entry: the dimension of the array WORK as declared in the (sub)program from which D05BYF is called.
Constraint: ${\mathbf{LWK}}\ge {2}^{{\mathbf{IQ}}+3}$.
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{IORDER}}<4$ or ${\mathbf{IORDER}}>6$, or ${\mathbf{IQ}}<0$, or ${\mathbf{LENFW}}<{2}^{{\mathbf{IQ}}+2}$, or ${\mathbf{LDSW}}<{2}^{{\mathbf{IQ}}+1}+2×{\mathbf{IORDER}}-1$, or ${\mathbf{LWK}}<{2}^{{\mathbf{IQ}}+3}$.

## 7  Accuracy

Not applicable.

Fractional quadrature weights can be used for solving weakly singular integral equations of Abel type. In this section, we propose the following algorithm which you may find useful in solving a linear weakly singular integral equation of the form
 $yt=ft+1π∫0tKt,sys t-s ds, 0≤t≤T,$ (2)
using D05BYF. 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 2p-2 W i,j K i×h,j×h yj + h ∑ j=2p-1 i ωi-j K i×h,j×h yj ,$ (3)
where ${y}_{\mathit{i}}\simeq y\left(\mathit{i}×h\right)$, for $\mathit{i}=1,2,\dots ,\mathit{N}$. We propose the following algorithm for computing ${y}_{i}$ from (3) after a call to D05BYF:
(a) Set $\mathit{N}={2}^{{\mathbf{IQ}}+1}+2×{\mathbf{IORDER}}-2$ and $h=T/\mathit{N}$.
(b) Equation (3) requires $2×{\mathbf{IORDER}}-2$ starting values, ${y}_{\mathit{j}}$, for $\mathit{j}=1,2,\dots ,2×{\mathbf{IORDER}}-2$, with ${y}_{0}=f\left(0\right)$. These starting values can be computed by solving the system
 $yi = fi×h + h ∑ j=0 2×IORDER-2 SWi+1j+1 K i×h,j×h yj , i=1,2,…,2×IORDER-2 .$
(c) Compute the inhomogeneous terms
 $σi = fi×h + h ∑ j=0 2×IORDER- 2 SWi+1j+1 K i×h,j×h yj , i = 2 × IORDER-1 , 2×IORDER , … , N .$
(d) Start the iteration for $i=2×{\mathbf{IORDER}}-1,2×{\mathbf{IORDER}},\dots ,\mathit{N}$ to compute ${y}_{i}$ from:
 $1 - h WT1 K i×h,i×h yi = σi + h ∑ j=2×IORDER-1 i-1 WTi-j+1 K i×h,j×h yj .$
Note that for nonlinear weakly singular equations, the solution of a nonlinear algebraic system is required at step (b) and a single nonlinear equation at step (d).

## 9  Example

The following example generates the first $16$ fractional convolution and $23$ fractional starting weights generated by the fourth-order BDF method.

### 9.1  Program Text

Program Text (d05byfe.f90)

None.

### 9.3  Program Results

Program Results (d05byfe.r)