NAG Library Routine Document
E02BDF computes the definite integral of a cubic spline from its B-spline representation.
||LAMDA(NCAP7), C(NCAP7), DINT
E02BDF computes the definite integral of the cubic spline
between the limits
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
and (augmented) ordered knot set
, (see E02BAF
is the number of intervals of the spline and
denotes the normalized B-spline of degree
) defined upon the knots
The method employed uses the formula given in Section 3 of Cox (1975)
E02BDF can be used to determine the definite integrals of cubic spline fits and interpolants produced by
Cox M G (1975) An algorithm for spline interpolation J. Inst. Math. Appl. 15 95–108
- 1: NCAP7 – 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.
- 2: LAMDA(NCAP7) – REAL (KIND=nag_wp) arrayInput
On entry: must be set to the value of the th member of the complete set of knots, , for .
the must be in nondecreasing order with and satisfy and .
- 3: C(NCAP7) – REAL (KIND=nag_wp) arrayInput
On entry: the coefficient
of the B-spline , for . The remaining elements of the array are not referenced.
- 4: DINT – REAL (KIND=nag_wp)Output
On exit: the value of the definite integral of between the limits and , where and .
- 5: IFAIL – INTEGERInput/Output
must be set to
. If you are unfamiliar with this parameter you should refer to Section 3.3
in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is
. When the value is used it is essential to test the value of IFAIL on exit.
unless the routine detects an error or a warning has been flagged (see Section 6
6 Error Indicators and Warnings
If on entry
, explanatory error messages are output on the current error message unit (as defined by X04AAF
Errors or warnings detected by the routine:
, i.e., the number of intervals is not positive.
At least one of the following restrictions on the knots is violated:
, with equality in the cases
, and NCAP7
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 .
The time taken is approximately proportional to .
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:
9.1 Program Text
Program Text (e02bdfe.f90)
9.2 Program Data
Program Data (e02bdfe.d)
9.3 Program Results
Program Results (e02bdfe.r)