NAG FL Interface
e01aaf (dim1_​aitken)

Settings help

FL Name Style:

FL Specification Language:

1 Purpose

e01aaf interpolates a function of one variable at a given point x from a table of function values yi evaluated at equidistant or non-equidistant points xi, for i=1,2,,n+1, using Aitken's technique of successive linear interpolations.

2 Specification

Fortran Interface
Subroutine e01aaf ( a, b, c, n1, n2, n, x)
Integer, Intent (In) :: n1, n2, n
Real (Kind=nag_wp), Intent (In) :: x
Real (Kind=nag_wp), Intent (Inout) :: a(n+1), b(n+1)
Real (Kind=nag_wp), Intent (Out) :: c(n*(n+1)/2)
C Header Interface
#include <nag.h>
void  e01aaf_ (double a[], double b[], double c[], const Integer *n1, const Integer *n2, const Integer *n, const double *x)
The routine may be called by the names e01aaf or nagf_interp_dim1_aitken.

3 Description

e01aaf interpolates a function of one variable at a given point x from a table of values xi and yi, for i=1,2,,n+1 using Aitken's method (see Fröberg (1970)). The intermediate values of linear interpolations are stored to enable an estimate of the accuracy of the results to be made.

4 References

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

5 Arguments

1: a(n+1) Real (Kind=nag_wp) array Input/Output
On entry: a(i) must contain the x-component of the ith data point, xi, for i=1,2,,n+1.
On exit: a(i) contains the value xi-x, for i=1,2,,n+1.
2: b(n+1) Real (Kind=nag_wp) array Input/Output
On entry: b(i) must contain the y-component (function value) of the ith data point, yi, for i=1,2,,n+1.
On exit: the contents of b are unspecified.
3: c(n×(n+1)/2) Real (Kind=nag_wp) array Output
On exit:
  • c(1),,c(n) contain the first set of linear interpolations,
  • c(n+1),,c(2×n-1) contain the second set of linear interpolations,
  • c(2n),,c(3×n-3) contain the third set of linear interpolations,
  • c(n×(n+1)/2) contains the interpolated function value at the point x.
4: n1 Integer Input
5: n2 Integer Input
On entry: n1 and n2 are no longer referenced, but are included for backwards compatability.
6: n Integer Input
On entry: the number of intervals which are to be used in interpolating the value at x; that is, there are n+1 data points (xi,yi).
Constraint: n>0.
7: x Real (Kind=nag_wp) Input
On entry: the point x at which the interpolation is required. Note that x may lie outside the interval defined by the minimum and maximum values in a, in which case an extrapolated value will be computed; extrapolated results should be treated with considerable caution since there is no information on the behaviour of the function outside the defined interval.

6 Error Indicators and Warnings


7 Accuracy

An estimate of the accuracy of the result can be made from a comparison of the final result and the previous interpolates, given in the array c. In particular, the first interpolate in the ith set, for i=1,2,,n, is the value at x of the polynomial interpolating the first (i+1) data points. It is given in position (i-1)(2n-i+2)/2 of the array c. Ideally, providing n is large enough, this set of n interpolates should exhibit convergence to the final value, the difference between one interpolate and the next settling down to a roughly constant magnitude (but with varying sign). This magnitude indicates the size of the error (any subsequent increase meaning that the value of n is too high). Better convergence will be obtained if the data points are supplied, not in their natural order, but ordered so that the first i data points give good coverage of the neighbourhood of x, for all i. To this end, the following ordering is recommended as widely suitable: first the point nearest to x, then the nearest point on the opposite side of x, followed by the remaining points in increasing order of their distance from x, that is of |xr-x|. With this modification the Aitken method will generally perform better than the related method of Neville, which is often given in the literature as superior to that of Aitken.

8 Parallelism and Performance

Background information to multithreading can be found in the Multithreading documentation.
e01aaf is not threaded in any implementation.

9 Further Comments

The computation time for interpolation at any point x is proportional to n×(n+1)/2.

10 Example

This example interpolates at x=0.28 the function value of a curve defined by the points
( 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 ) .  

10.1 Program Text

Program Text (e01aafe.f90)

10.2 Program Data

Program Data (e01aafe.d)

10.3 Program Results

Program Results (e01aafe.r)