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..::..Int32On entry: , the number of data points.Constraint: .
- x
- Type: array<System..::..Double>[]()[][]An array of size [m]On entry: must be set to , the th data value of the independent variable , for .Constraint: , for .
- y
- Type: array<System..::..Double>[]()[][]An array of size [m]On entry: must be set to , the th data value of the dependent variable , for .
- lamda
- Type: array<System..::..Double>[]()[][]An array of size [lck]On exit: the value of , the th knot, for .
- c
- Type: array<System..::..Double>[]()[][]An array of size [lck]On exit: the coefficient of the B-spline , for . The remaining elements of the array are not used.
- ifail
- Type: System..::..Int32%On exit: unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).
Description
e01ba determines a cubic spline , defined in the range , which interpolates (passes exactly through) the set of data points , for , where and . Unlike some other spline interpolation algorithms, derivative end conditions are not imposed. The spline interpolant chosen has interior knots , which are set to the values of respectively. This spline is represented in its B-spline form (see Cox (1975)):
where denotes the normalized B-spline of degree ,
defined upon the knots , and denotes its coefficient, whose value is to be determined by the method.
The use of B-splines requires eight additional knots , ,
, ,
, ,
and to be specified; e01ba sets the first four of these to and the last four to .
The algorithm for determining the coefficients is as described in
Cox (1975) except that factorization is used instead of 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:
On entry, , or , or .
- The x-values fail to satisfy the condition.
Accuracy
The rounding errors incurred are such that the computed spline is an exact interpolant for a slightly perturbed set of ordinates . The ratio of the root-mean-square value of the to that of the 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 .
All the are used as knot positions except and . This choice of knots
(see Cox (1977)) means that is composed of cubic arcs as follows. If , there is just a single arc space spanning the whole interval to . If , the first and last arcs span the intervals to and to respectively. Additionally if , the th arc, for , spans the interval to .
After the call
the following operations may be carried out on the interpolant .
The values of and its first three derivatives at can be provided in the real array s
of dimension , 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 over the range to can be provided in the
real variable
dint
by
(see (E02BDF not in this release)).
Example
This example sets up data from values of the exponential function in the interval to . e01ba is then called to compute a spline interpolant to these data.