e01ba determines a cubic spline interpolant to a given set of data.

Syntax

C#
public static void e01ba(
	int m,
	double[] x,
	double[] y,
	double[] lamda,
	double[] c,
	out int ifail
)
Visual Basic
Public Shared Sub e01ba ( _
	m As Integer, _
	x As Double(), _
	y As Double(), _
	lamda As Double(), _
	c As Double(), _
	<OutAttribute> ByRef ifail As Integer _
)
Visual C++
public:
static void e01ba(
	int m, 
	array<double>^ x, 
	array<double>^ y, 
	array<double>^ lamda, 
	array<double>^ c, 
	[OutAttribute] int% ifail
)
F#
static member e01ba : 
        m : int * 
        x : float[] * 
        y : float[] * 
        lamda : float[] * 
        c : float[] * 
        ifail : int byref -> unit 

Parameters

m
Type: System..::..Int32
On entry: m, the number of data points.
Constraint: m4.
x
Type: array<System..::..Double>[]()[][]
An array of size [m]
On entry: x[i-1] must be set to xi, the ith data value of the independent variable x, for i=1,2,,m.
Constraint: x[i-1]<x[i], for i=1,2,,m-1.
y
Type: array<System..::..Double>[]()[][]
An array of size [m]
On entry: y[i-1] must be set to yi, the ith data value of the dependent variable y, for i=1,2,,m.
lamda
Type: array<System..::..Double>[]()[][]
An array of size [lck]
On exit: the value of λi, the ith knot, for i=1,2,,m+4.
c
Type: array<System..::..Double>[]()[][]
An array of size [lck]
On exit: the coefficient ci of the B-spline Nix, for i=1,2,,m. The remaining elements of the array are not used.
ifail
Type: System..::..Int32%
On exit: ifail=0 unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).

Description

e01ba determines a cubic spline sx, defined in the range x1xxm, which interpolates (passes exactly through) the set of data points xi,yi, for i=1,2,,m, where m4 and x1<x2<<xm. Unlike some other spline interpolation algorithms, derivative end conditions are not imposed. The spline interpolant chosen has m-4 interior knots λ5,λ6,,λm, which are set to the values of x3,x4,,xm-2 respectively. This spline is represented in its B-spline form (see Cox (1975)):
sx=i=1mciNix,
where Nix denotes the normalized B-spline of degree 3, defined upon the knots λi,λi+1,,λi+4, and ci denotes its coefficient, whose value is to be determined by the method.
The use of B-splines requires eight additional knots λ1, λ2, λ3, λ4, λm+1, λm+2, λm+3 and λm+4 to be specified; e01ba sets the first four of these to x1 and the last four to xm.
The algorithm for determining the coefficients is as described in Cox (1975) except that QR factorization is used instead of LU decomposition. The implementation of the algorithm involves setting up appropriate information for the related method (E02BAF not in this release) followed by a call of that method. (See (E02BAF not in this release) for further details.)
Values of the spline interpolant, or of its derivatives or definite integral, can subsequently be computed as detailed in [Further Comments].

References

Cox M G (1975) An algorithm for spline interpolation J. Inst. Math. Appl. 15 95–108
Cox M G (1977) A survey of numerical methods for data and function approximation The State of the Art in Numerical Analysis (ed D A H Jacobs) 627–668 Academic Press

Error Indicators and Warnings

Errors or warnings detected by the method:
ifail=1
On entry,m<4,
orlck<m+4,
orlwrk<6×m+16.
ifail=2
The x-values fail to satisfy the condition
x[0]<x[1]<x[2]<<x[m-1].
ifail=-9000
An error occured, see message report.
ifail=-1000
The array lengths are not the same for arrays
ifail=-8000
Negative dimension for array value
ifail=-6000
Invalid Parameters value

Accuracy

The rounding errors incurred are such that the computed spline is an exact interpolant for a slightly perturbed set of ordinates yi+δyi. The ratio of the root-mean-square value of the δyi to that of the yi is no greater than a small multiple of the relative machine precision.

Parallelism and Performance

None.

Further Comments

The time taken by e01ba is approximately proportional to m.
All the xi are used as knot positions except x2 and xm-1. This choice of knots (see Cox (1977)) means that sx is composed of m-3 cubic arcs as follows. If m=4, there is just a single arc space spanning the whole interval x1 to x4. If m5, the first and last arcs span the intervals x1 to x3 and xm-2 to xm respectively. Additionally if m6, the ith arc, for i=2,3,,m-4, spans the interval xi+1 to xi+2.
After the call the following operations may be carried out on the interpolant sx.
The value of sx at x=x can be provided in the real variable s by the call (see e02bb).
The values of sx and its first three derivatives at x=x can be provided in the real array s of dimension 4, by the call (see (E02BCF not in this release)).
Here left must specify whether the left- or right-hand value of the third derivative is required (see (E02BCF not in this release) for details).
The value of the integral of sx over the range x1 to xm can be provided in the real variable dint by (see (E02BDF not in this release)).

Example

This example sets up data from 7 values of the exponential function in the interval 0 to 1. e01ba is then called to compute a spline interpolant to these data.

Example program (C#): e01bae.cs

Example program results: e01bae.r

See Also