e01bff evaluates a piecewise cubic Hermite interpolant, as computed by
e01bef, at the points
, for
. If any point lies outside the interval from
to
, a value is extrapolated from the nearest extreme cubic, and a warning is returned.
The routine is derived from routine PCHFE in
Fritsch (1982).
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
x04aaf).
The computational errors in the array
pf should be negligible in most practical situations.
The time taken by
e01bff is approximately proportional to the number of evaluation points,
. The evaluation will be most efficient if the elements of
px are in nondecreasing order (or,
more generally, if they are grouped in increasing order of the intervals
). A single call of
e01bff with
is more efficient than several calls with
.
As documented above, this routine will use extrapolation if presented with evaluation points outside the region
. Since such extrapolated values are computed simply by extending the cubic approximation at each end interval, the values may not be suitable for all purposes. If you need more control over how values outside the original region are calculated, consider the following possible procedures for degree
,
and
extrapolation.
-
(i)
Flat extrapolation
-
For choose ;
-
for choose .
-
(ii)
Linear extrapolation
-
For , call e01bgf using to obtain , then choose ;
-
for , call e01bgf using to obtain , then choose .
-
(iii)
Quadratic extrapolation
-
For , call e01bgf to obtain derivative values and at and ,
- if revert to linear extrapolation (ii),
- otherwise let and , then choose ;
-
for , call e01bgf to obtain derivative values and at and ,
- if revert to linear extrapolation (ii),
- otherwise let and , then choose .
This example reads in values of
n,
x,
f and
d, and then calls
e01bff to evaluate the interpolant at equally spaced points.