nag_monotonic_evaluate (e01bfc) evaluates a piecewise cubic Hermite interpolant at a set of points.
A piecewise cubic Hermite interpolant, as computed by nag_monotonic_interpolant (e01bec)
, is evaluated at the points
. If any point lies outside the interval from
, a value is extrapolated from the nearest extreme cubic, and a warning is returned.
The algorithm is derived from routine PCHFE in Fritsch (1982)
The computational errors in the array pf
should be negligible in most practical situations.
The time taken by nag_monotonic_evaluate (e01bfc) 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 nag_monotonic_evaluate (e01bfc) with
is more efficient than several calls with
This example program reads in values of n
, and then calls nag_monotonic_evaluate (e01bfc) to evaluate the interpolant at equally spaced points.