|
NAG[e02bcc] NAG[nag_1d_spline_deriv] - Evaluation of fitted cubic spline, function and derivatives
|
|
Calling Sequence
e02bcc(derivs, x, s, spline_data, 'fail'=fail)
nag_1d_spline_deriv(. . .)
Parameters
|
derivs - String;
|
|
|
Constraint: "Nag_LeftDerivs" or "Nag_RightDerivs". .
|
|
|
x - float;
|
|
|
On entry: the argument at which the cubic spline and its derivatives are to be evaluated.
|
|
Constraint: . .
|
|
|
s - Vector(1.. , datatype=float[8]);
|
|
|
|
spline_data - table;
|
|
|
A Maple table, which should be generated using NAG[Nag_Spline], corresponding to the Nag_Spline structure.
|
|
Constraint: . .
|
|
lamda - Vector(datatype=float[8])
|
|
Constraint: the must be in non-decreasing order with . .
|
|
c - Vector(datatype=float[8])
|
|
|
'fail'=fail - table; (optional)
|
|
|
The NAG error argument, see the documentation for NagError.
|
|
|
|
Description
|
|
|
Purpose
|
|
nag_1d_spline_deriv (e02bcc) evaluates a cubic spline and its first three derivatives from its B-spline representation.
|
|
Description
|
|
nag_1d_spline_deriv (e02bcc) evaluates the cubic spline and its first three derivatives at a prescribed argument . It is assumed that is represented in terms of its B-spline coefficients , for and (augmented) ordered knot set , for , (see e02bac (nag_1d_spline_fit_knots)), i.e.,
Here , is the number of intervals of the spline and denotes the normalized B-spline of degree 3 (order 4) defined upon the knots . The prescribed argument must satisfy .
At a simple knot (i.e., one satisfying ), the third derivative of the spline is in general discontinuous. At a multiple knot (i.e., two or more knots with the same value), lower derivatives, and even the spline itself, may be discontinuous. Specifically, at a point where (exactly) knots coincide (such a point is termed a knot of multiplicity ), the values of the derivatives of order , for , are in general discontinuous. (Here is not meaningful.) The user must specify whether the value at such a point is required to be the left- or right-hand derivative.
The method employed is based upon:
|
carrying out a binary search for the knot interval containing the argument (see Cox (1978)),
|
|
evaluating the non-zero B-splines of orders 1,2,3 and 4 by recurrence (see Cox (1972a) and Cox (1978)),
|
|
computing all derivatives of the B-splines of order 4 by applying a second recurrence to these computed B-spline values (see De Boor (1972)),
|
|
multiplying the 4th-order B-spline values and their derivative by the appropriate B-spline coefficients, and summing, to yield the values of and its derivatives.
|
nag_1d_spline_deriv (e02bcc) can be used to compute the values and derivatives of cubic spline fits and interpolants produced by e02bac (nag_1d_spline_fit_knots), e02bec (nag_1d_spline_fit) or e01bac (nag_1d_spline_interpolant).
If only values and not derivatives are required, e02bbc (nag_1d_spline_evaluate) may be used instead of nag_1d_spline_deriv (e02bcc), which takes about 50% longer than e02bbc (nag_1d_spline_evaluate).
|
|
Error Indicators and Warnings
|
|
"NE_ABSCI_OUTSIDE_KNOT_INTVL"
On entry, x must satisfy : , , .
"NE_BAD_PARAM"
On entry, argument derivs had an illegal value.
"NE_INT_ARG_LT"
On entry, n must not be less than 8: .
"NE_SPLINE_RANGE_INVALID"
On entry, the cubic spline range is invalid: while . These must satisfy .
|
|
|
Examples
|
|
>
|
derivs := "Nag_LeftDerivs":
x := 0:
spline_data := NAG:-Nag_Spline():
spline_data['n'] := 14:
spline_data['lamda'] := Vector([ 0, 0, 0, 0, 1, 3, 3, 3, 4, 4, 6, 6, 6, 6 ],
datatype=float[8]):
spline_data['c'] := Vector([ 10, 12, 13, 15, 22, 26, 24, 18, 14, 12 ],
datatype=float[8]):
s := Vector(4, datatype=float[8]):
NAG:-e02bcc(derivs, x, s, spline_data):
|
|
|
See Also
|
|
Cox M G (1972a) 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
De Boor C (1972) On calculating with B-splines J. Approx. Theory 6 50–62
e02 Chapter Introduction.
NAG Toolbox Overview.
NAG Web Site.
|
|