e02bb evaluates a cubic spline from its B-spline representation.
Syntax
C# |
---|
public static void e02bb( int ncap7, double[] lamda, double[] c, double x, out double s, out int ifail ) |
Visual Basic |
---|
Public Shared Sub e02bb ( _ ncap7 As Integer, _ lamda As Double(), _ c As Double(), _ x As Double, _ <OutAttribute> ByRef s As Double, _ <OutAttribute> ByRef ifail As Integer _ ) |
Visual C++ |
---|
public: static void e02bb( int ncap7, array<double>^ lamda, array<double>^ c, double x, [OutAttribute] double% s, [OutAttribute] int% ifail ) |
F# |
---|
static member e02bb : ncap7 : int * lamda : float[] * c : float[] * x : float * s : float byref * ifail : int byref -> unit |
Parameters
- ncap7
- Type: System..::..Int32On entry: , where is the number of intervals (one greater than the number of interior knots, i.e., the knots strictly within the range to ) over which the spline is defined.Constraint: .
- lamda
- Type: array<System..::..Double>[]()[][]An array of size [ncap7]On entry: must be set to the value of the th member of the complete set of knots, , for .Constraint: the must be in nondecreasing order with .
- c
- Type: array<System..::..Double>[]()[][]An array of size [ncap7]On entry: the coefficient of the B-spline , for . The remaining elements of the array are not referenced.
- x
- Type: System..::..DoubleOn entry: the argument at which the cubic spline is to be evaluated.Constraint: .
- s
- Type: System..::..Double%On exit: the value of the spline, .
- ifail
- Type: System..::..Int32%On exit: unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).
Description
e02bb evaluates the cubic spline at a prescribed argument from its augmented knot set , for , (see (E02BAF not in this release)) and from the coefficients , for in its B-spline representation
Here , where is the number of intervals of the spline, and denotes the normalized B-spline of degree defined upon the knots . The prescribed argument must satisfy .
It is assumed that , for , and .
If is a point at which knots coincide, is discontinuous at ; in this case, s contains the value defined as is approached from the right.
The method employed is that of evaluation by taking convex combinations due to de Boor (1972). For further details of the algorithm and its use see Cox (1972) and Cox and Hayes (1973).
References
Cox M G (1972) The numerical evaluation of B-splines J. Inst. Math. Appl. 10 134–149
Cox M G (1978) The numerical evaluation of a spline from its B-spline representation J. Inst. Math. Appl. 21 135–143
Cox M G and Hayes J G (1973) Curve fitting: a guide and suite of algorithms for the non-specialist user NPL Report NAC26 National Physical Laboratory
de Boor C (1972) On calculating with B-splines J. Approx. Theory 6 50–62
Error Indicators and Warnings
Errors or warnings detected by the method:
- , i.e., the number of interior knots is negative.
Accuracy
The computed value of has negligible error in most practical situations. Specifically, this value has an absolute error bounded in modulus by , where is the largest in modulus of and , and is an integer such that . If and are all of the same sign, then the computed value of has a relative error not exceeding in modulus. For further details see Cox (1978).
Parallelism and Performance
None.
Further Comments
The time taken is approximately seconds, where c is a machine-dependent constant.
Note: the method does not test all the conditions on the knots given in the description of lamda in [Parameters], since to do this would result in a computation time approximately linear in instead of . All the conditions are tested in (E02BAF not in this release), however.
Example
Evaluate at nine equally-spaced points in the interval the cubic spline with (augmented) knots , , , , , , , , , , and normalized cubic B-spline coefficients , , , , , , .
The example program is written in a general form that will enable a cubic spline with intervals, in its normalized cubic B-spline form, to be evaluated at equally-spaced points in the interval . The program is self-starting in that any number of datasets may be supplied.
Example program (C#): e02bbe.cs