Note: the interface to this routine has changed since earlier releases of the toolbox:
At Mark 23: |
n1 is no longer an optional input parameter; n2 is no longer an input parameter |
nag_interp_1d_everett (e01ab) interpolates a function of one variable at a given point
where
and
is the interval of differencing, from a table of values
and
where
. The formula used is that of
Fröberg (1970), neglecting the remainder term:
The values of
and
are stored on exit from the function in addition to the interpolated function value
.
None.
In general, increasing
improves the accuracy of the result until full attainable accuracy is reached, after which it might deteriorate. If
lies in the central interval of the data (i.e.,
), as is desirable, an upper bound on the contribution of the highest order differences (which is usually an upper bound on the error of the result) is given approximately in terms of the elements of the array
g by
, where
,
,
,
,
for
respectively, thereafter decreasing roughly by a factor of
each time.
This example interpolates at the point
from the function values
We take
and
.
function e01ab_example
fprintf('e01ab example results\n\n');
a = [-1 -0.50 0 0.50 1 1.50];
b = [ 0 -0.53 -1 -0.46 2 11.09];
n = int64(size(a,2)/2);
x = 0.28;
p = (x-a(n))/0.5;
[bx, c, ifail] = e01ab(n, p, b);
for k = 0:n-1
fprintf('Central differences order %4d of y_0 = %12.5f\n', k, c(2*k+1));
fprintf('%37s = %12.5f\n', 'y_1',c(2*k+2));
end
fprintf('\nFunction value at interpolation point = %12.5f\n', c(end));