E01ABF (PDF version)
E01 Chapter Contents
E01 Chapter Introduction
NAG Library Manual

NAG Library Routine Document

E01ABF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

 Contents

    1  Purpose
    7  Accuracy

1  Purpose

E01ABF interpolates a function of one variable at a given point x from a table of function values evaluated at equidistant points, using Everett's formula.

2  Specification

SUBROUTINE E01ABF ( N, P, A, G, N1, N2, IFAIL)
INTEGER  N, N1, N2, IFAIL
REAL (KIND=nag_wp)  P, A(N1), G(N2)

3  Description

E01ABF interpolates a function of one variable at a given point
x=x0+ph,  
where -1<p<1 and h is the interval of differencing, from a table of values xm=x0+mh and ym where m=-n-1,-n-2,,-1,0,1,,n. The formula used is that of Fröberg (1970), neglecting the remainder term:
yp=r=0 n-1 1-p+r 2r+1 δ2ry0+r=0 n-1 p+r 2r+1 δ2ry1.  
The values of δ2ry0 and δ2ry1 are stored on exit from the routine in addition to the interpolated function value yp.

4  References

Fröberg C E (1970) Introduction to Numerical Analysis Addison–Wesley

5  Parameters

1:     N – INTEGERInput
On entry: n, half the number of points to be used in the interpolation.
Constraint: N>0.
2:     P – REAL (KIND=nag_wp)Input
On entry: the point p at which the interpolated function value is required, i.e., p=x-x0/h with -1.0<p<1.0.
Constraint: -1.0<P<1.0.
3:     AN1 – REAL (KIND=nag_wp) arrayInput/Output
On entry: Ai must be set to the function value yi-n, for i=1,2,,2n.
On exit: the contents of A are unspecified.
4:     GN2 – REAL (KIND=nag_wp) arrayOutput
On exit: the array contains
δ2ry0in G1
δ2ry1in G2
δ2ry0in G2r+1
δ2ry1in G2r+2, for r=1,2,,n-1.
The interpolated function value yp is stored in G2n+1.
5:     N1 – INTEGERInput
On entry: the value 2n, that is, N1 is equal to the number of data points.
6:     N2 – INTEGERInput
On entry: the value 2n+1, that is, N2 is one more than the number of data points.
7:     IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to 0, -1​ or ​1. 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 -1​ or ​1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is 0. When the value -1​ or ​1 is used it is essential to test the value of IFAIL on exit.
On exit: IFAIL=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6  Error Indicators and Warnings

If on entry IFAIL=0 or -1, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
IFAIL=1
On entry,P-1.0,
orP1.0.
IFAIL=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 3.8 in the Essential Introduction for further information.
IFAIL=-399
Your licence key may have expired or may not have been installed correctly.
See Section 3.7 in the Essential Introduction for further information.
IFAIL=-999
Dynamic memory allocation failed.
See Section 3.6 in the Essential Introduction for further information.

7  Accuracy

In general, increasing n improves the accuracy of the result until full attainable accuracy is reached, after which it might deteriorate. If x lies in the central interval of the data (i.e., 0.0p<1.0), 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 a×G2n-1+G2n, where a=0.1, 0.02, 0.005, 0.001, 0.0002 for n=1,2,3,4,5 respectively, thereafter decreasing roughly by a factor of 4 each time.

8  Parallelism and Performance

Not applicable.

9  Further Comments

The computation time increases as the order of n increases.

10  Example

This example interpolates at the point x=0.28 from the function values
xi -1.00 -0.50 0.00 0.50 1.00 1.50 yi 0.00 -0.53 -1.00 -0.46 2.00 11.09 .  
We take n=3 and p=0.56.

10.1  Program Text

Program Text (e01abfe.f90)

10.2  Program Data

Program Data (e01abfe.d)

10.3  Program Results

Program Results (e01abfe.r)


E01ABF (PDF version)
E01 Chapter Contents
E01 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2015