# NAG FL Interfaced04bbf (sample)

## ▸▿ Contents

Settings help

FL Name Style:

FL Specification Language:

## 1Purpose

d04bbf generates abscissae about a target abscissa ${x}_{0}$ for use in a subsequent call to d04baf.

## 2Specification

Fortran Interface
 Subroutine d04bbf ( x_0, xval)
 Real (Kind=nag_wp), Intent (In) :: x_0, hbase Real (Kind=nag_wp), Intent (Out) :: xval(21)
#include <nag.h>
 void d04bbf_ (const double *x_0, const double *hbase, double xval[])
The routine may be called by the names d04bbf or nagf_numdiff_sample.

## 3Description

d04bbf may be used to generate the necessary abscissae about a target abscissa ${x}_{0}$ for the calculation of derivatives using d04baf.
For a given ${x}_{0}$ and $h$, the abscissae correspond to the set $\left\{{x}_{0},{x}_{0}±\left(2\mathit{j}-1\right)h\right\}$, for $\mathit{j}=1,2,\dots ,10$. These $21$ points will be returned in ascending order in xval. In particular, ${\mathbf{xval}}\left(11\right)$ will be equal to ${x}_{0}$.

## 4References

Lyness J N and Moler C B (1969) Generalised Romberg methods for integrals of derivatives Numer. Math. 14 1–14

## 5Arguments

1: $\mathbf{x_0}$Real (Kind=nag_wp) Input
On entry: the abscissa ${x}_{0}$ at which derivatives are required.
2: $\mathbf{hbase}$Real (Kind=nag_wp) Input
On entry: the chosen step size $h$. If $h<10\epsilon$, where $\epsilon ={\mathbf{x02ajf}}\left(\right)$, the default $h={\epsilon }^{\left(1/4\right)}$ will be used.
3: $\mathbf{xval}\left(21\right)$Real (Kind=nag_wp) array Output
On exit: the abscissae for passing to d04baf.

None.

Not applicable.

## 8Parallelism and Performance

d04bbf is not threaded in any implementation.

The results computed by d04baf depend very critically on the choice of the user-supplied step length $h$. The overall accuracy is diminished as $h$ becomes small (because of the effect of round-off error) and as $h$ becomes large (because the discretization error also becomes large). If the process of calculating derivatives is repeated four or five times with different values of $h$ one can find a reasonably good value. A process in which the value of $h$ is successively halved (or doubled) is usually quite effective. Experience has shown that in cases in which the Taylor series for for the objective function about ${x}_{0}$ has a finite radius of convergence $R$, the choices of $h>R/19$ are not likely to lead to good results. In this case some function values lie outside the circle of convergence.

See d04baf.