NAG Library Routine Document
E01ABF interpolates a function of one variable at a given point from a table of function values evaluated at equidistant points, using Everett's formula.
||N, N1, N2, IFAIL
||P, A(N1), G(N2)
E01ABF interpolates a function of one variable at a given point
is the interval of differencing, from a table of values
. The formula used is that of Fröberg (1970)
, neglecting the remainder term:
The values of
are stored on exit from the routine in addition to the interpolated function value
Fröberg C E (1970) Introduction to Numerical Analysis Addison–Wesley
- 1: N – INTEGERInput
On entry: , half the number of points to be used in the interpolation.
- 2: P – REAL (KIND=nag_wp)Input
On entry: the point at which the interpolated function value is required, i.e., with .
- 3: A(N1) – REAL (KIND=nag_wp) arrayInput/Output
On entry: must be set to the function value , for .
: the contents of A
- 4: G(N2) – REAL (KIND=nag_wp) arrayOutput
: the array contains
, for .
The interpolated function value is stored in .
- 5: N1 – INTEGERInput
: the value
, that is, N1
is equal to the number of data points.
- 6: N2 – INTEGERInput
: the value
, that is, N2
is one more than the number of data points.
- 7: IFAIL – INTEGERInput/Output
must be set to
. If you are unfamiliar with this parameter you should refer to Section 3.3
in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is
. When the value is used it is essential to test the value of IFAIL on exit.
unless the routine detects an error or a warning has been flagged (see Section 6
6 Error Indicators and Warnings
If on entry
, explanatory error messages are output on the current error message unit (as defined by X04AAF
Errors or warnings detected by the routine:
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
respectively, thereafter decreasing roughly by a factor of
The computation time increases as the order of increases.
This example interpolates at the point
from the function values
9.1 Program Text
Program Text (e01abfe.f90)
9.2 Program Data
Program Data (e01abfe.d)
9.3 Program Results
Program Results (e01abfe.r)