c06baf performs Shanks' transformation on a given sequence of real values by means of the Epsilon algorithm of Wynn (1956). A (possibly unreliable) estimate of the absolute error is also given.
The routine must be called repetitively, once for each new term in the sequence.
4
References
Shanks D (1955) Nonlinear transformations of divergent and slowly convergent sequences J. Math. Phys.34 1–42
Wynn P (1956) On a device for computing the ${e}_{m}\left({S}_{n}\right)$ transformation Math. Tables Aids Comput.10 91–96
5
Arguments
1: $\mathbf{seqn}$ – Real (Kind=nag_wp)Input
On entry: the next term of the sequence to be considered.
2: $\mathbf{ncall}$ – IntegerInput/Output
On entry: on the first call ncall must be set to $0$. Thereafter ncallmust not be changed between calls.
On exit: the number of terms in the sequence that have been considered.
3: $\mathbf{result}$ – Real (Kind=nag_wp)Output
On exit: the estimate of the limit of the sequence. For the first two calls, ${\mathbf{result}}={\mathbf{seqn}}$.
4: $\mathbf{abserr}$ – Real (Kind=nag_wp)Output
On exit: an estimate of the absolute error in result. For the first three calls, abserr is set to a large machine-dependent constant.
5: $\mathbf{work}\left({\mathbf{lwork}}\right)$ – Real (Kind=nag_wp) arrayCommunication Array
Used as workspace, but must not be changed between calls.
6: $\mathbf{lwork}$ – IntegerInput
On entry: the dimension of the array work as declared in the (sub)program from which c06baf is called.
Suggested value:
$\text{(maximum number of terms in the sequence)}+6$. See Section 9.2.
Constraint:
${\mathbf{lwork}}\ge 7$.
7: $\mathbf{ifail}$ – IntegerInput/Output
On entry: ifail must be set to $0$, $-1\text{ or}1$. If you are unfamiliar with this argument you should refer to Section 3.4 in How to Use the NAG Library and its Documentation 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 argument, 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}}=0$ or $-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{ncall}}<0$.
${\mathbf{ifail}}=2$
On entry,
${\mathbf{lwork}}<7$.
${\mathbf{ifail}}=-99$
An unexpected error has been triggered by this routine. Please
contact NAG.
See Section 3.9 in How to Use the NAG Library and its Documentation for further information.
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
See Section 3.8 in How to Use the NAG Library and its Documentation for further information.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
See Section 3.7 in How to Use the NAG Library and its Documentation for further information.
7
Accuracy
The accuracy of the absolute error estimate abserr varies considerably with the type of sequence to which the routine is applied. In general it is better when applied to oscillating sequences than to monotonic sequences where it may be a severe underestimate.
8
Parallelism and Performance
c06baf is not threaded in any implementation.
9
Further Comments
9.1
Timing
The time taken is approximately proportional to the final value of ncall.
For long sequences, a ‘window’ of the last $n$ values can be used instead of all the terms of the sequence. Tests on a variety of problems indicate that a suitable value is $n=50$; this implies a value for lwork of $56$. You are advised to experiment with other values for your own specific problems.
9.3
Convergence
c06baf will induce convergence in some divergent sequences. See Shanks (1955) for more details.