NAG CL Interface
e02bdc (dim1_spline_integ)
1
Purpose
e02bdc computes the definite integral of a cubic spline from its B-spline representation.
2
Specification
The function may be called by the names: e02bdc, nag_fit_dim1_spline_integ or nag_1d_spline_intg.
3
Description
e02bdc computes the definite integral of the cubic spline
between the limits
and
, where
and
are respectively the lower and upper limits of the range over which
is defined. It is assumed that
is represented in terms of its B-spline coefficients
, for
and (augmented) ordered knot set
, for
, with
, for
and
, for
, (see
e02bac), i.e.,
Here
,
is the number of intervals of the spline and
denotes the normalized B-spline of degree
(order
) defined upon the knots
.
The method employed uses the formula given in Section 3 of
Cox (1975).
e02bdc can be used to determine the definite integrals of cubic spline fits and interpolants produced by
e01bac,
e02bac and
e02bec.
4
References
Cox M G (1975) An algorithm for spline interpolation J. Inst. Math. Appl. 15 95–108
5
Arguments
-
1:
– Nag_Spline *
-
Pointer to structure of type Nag_Spline with the following members:
- n – IntegerInput
-
On entry: , where is the number of intervals of the spline (which is 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 – double *Input
-
On entry: a pointer to which memory of size must be allocated. 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
and satisfy
and
- c – double *Input
-
On entry: a pointer to which memory of size must be allocated. holds the coefficient of the B-spline , for .
-
2:
– double *
Output
-
On exit: the value of the definite integral of between the limits and , where and .
-
3:
– NagError *
Input/Output
-
The NAG error argument (see
Section 7 in the Introduction to the NAG Library CL Interface).
6
Error Indicators and Warnings
- NE_INT_ARG_LT
-
On entry, must not be less than 8: .
- NE_KNOTS_CONS
-
On entry, the knots must satisfy the following constraints:
, , for , with equality in the cases , , and .
7
Accuracy
The rounding errors are such that the computed value of the integral is exact for a slightly perturbed set of B-spline coefficients differing in a relative sense from those supplied by no more than .
8
Parallelism and Performance
Background information to multithreading can be found in the
Multithreading documentation.
e02bdc is not threaded in any implementation.
Under normal usage, the call to
e02bdc will follow a call to
e01bac,
e02bac or
e02bec. In that case, the structure
spline will have been set up correctly for input to
e02bdc.
The time taken is approximately proportional to .
10
Example
This example determines the definite integral over the interval of a cubic spline having interior knots at the positions , , , , , , the additional knots , , , , , , , , and the B-spline coefficients , , , , , , , , , .
The input data items (using the notation of
Section 5) comprise the following values in the order indicated:
|
|
, |
for |
, |
for |
The example program is written in a general form that will enable the definite integral of a cubic spline having an arbitrary number of knots to be computed. Any number of datasets may be supplied. The only changes required to the program relate to the size of
and the storage allocated to
within the structure
spline.
10.1
Program Text
10.2
Program Data
10.3
Program Results