PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_fit_1dspline_integ (e02bd)
Purpose
nag_fit_1dspline_integ (e02bd) computes the definite integral of a cubic spline from its B-spline representation.
Syntax
Description
nag_fit_1dspline_integ (e02bd) 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
nag_fit_1dspline_knots (e02ba)), 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).
nag_fit_1dspline_integ (e02bd) can be used to determine the definite integrals of cubic spline fits and interpolants produced by
nag_fit_1dspline_knots (e02ba).
References
Cox M G (1975) An algorithm for spline interpolation J. Inst. Math. Appl. 15 95–108
Parameters
Compulsory Input Parameters
- 1:
– double array
-
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 .
- 2:
– double array
-
The coefficient
of the B-spline , for . The remaining elements of the array are not referenced.
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the dimension of the arrays
lamda,
c. (An error is raised if these dimensions are not equal.)
, 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:
.
Output Parameters
- 1:
– double scalar
-
The value of the definite integral of between the limits and , where and .
- 2:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Errors or warnings detected by the function:
-
-
, i.e., the number of intervals is not positive.
-
-
At least one of the following restrictions on the knots is violated:
- ,
- ,
for
, with equality in the cases
, and
ncap7
-
An unexpected error has been triggered by this routine. Please
contact
NAG.
-
Your licence key may have expired or may not have been installed correctly.
-
Dynamic memory allocation failed.
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 .
Further Comments
The time taken is approximately proportional to .
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
Arguments) comprise the following values in the order indicated:
|
|
, |
for |
, |
for |
Open in the MATLAB editor:
e02bd_example
function e02bd_example
fprintf('e02bd example results\n\n');
knots = [ 1 3 3 3 4 4];
ncap = size(knots,2) + 1;
ncap7 = ncap + 7;
lamda = zeros(ncap7,1);
lamda(5:ncap+3) = knots;
lamda(ncap+4:ncap7) = 6;
c = zeros(ncap7,1);
c(1:ncap+3) = [10 12 13 15 22 26 24 18 14 12];
[dint, ifail] = e02bd( ...
lamda, c);
fprintf('Definite integral = %10.3e\n',dint);
e02bd example results
Definite integral = 1.000e+02
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015