NAG Library Routine Document
E01BEF
1 Purpose
E01BEF computes a monotonicity-preserving piecewise cubic Hermite interpolant to a set of data points.
2 Specification
INTEGER |
N, IFAIL |
REAL (KIND=nag_wp) |
X(N), F(N), D(N) |
|
3 Description
E01BEF estimates first derivatives at the set of data points
, for
, which determine a piecewise cubic Hermite interpolant to the data, that preserves monotonicity over ranges where the data points are monotonic. If the data points are only piecewise monotonic, the interpolant will have an extremum at each point where monotonicity switches direction. The estimates of the derivatives are computed by a formula due to Brodlie,
which is described in
Fritsch and Butland (1984), with suitable changes at the boundary points.
The routine is derived from routine PCHIM in
Fritsch (1982).
Values of the computed interpolant, and of its first derivative and definite integral, can subsequently be computed by calling
E01BFF,
E01BGF and
E01BHF, as described in
Section 9.
4 References
Fritsch F N (1982) PCHIP final specifications Report UCID-30194 Lawrence Livermore National Laboratory
Fritsch F N and Butland J (1984) A method for constructing local monotone piecewise cubic interpolants SIAM J. Sci. Statist. Comput. 5 300–304
5 Parameters
- 1: – INTEGERInput
-
On entry: , the number of data points.
Constraint:
.
- 2: – REAL (KIND=nag_wp) arrayInput
-
On entry: must be set to , the th value of the independent variable (abscissa), for .
Constraint:
.
- 3: – REAL (KIND=nag_wp) arrayInput
-
On entry: must be set to , the th value of the dependent variable (ordinate), for .
- 4: – REAL (KIND=nag_wp) arrayOutput
-
On exit: estimates of derivatives at the data points. contains the derivative at .
- 5: – INTEGERInput/Output
-
On entry:
IFAIL 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.
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
or
, explanatory error messages are output on the current error message unit (as defined by
X04AAF).
Errors or warnings detected by the routine:
-
-
The values of , for , are not in strictly increasing order.
An unexpected error has been triggered by this routine. Please
contact
NAG.
See
Section 3.8 in the Essential Introduction for further information.
Your licence key may have expired or may not have been installed correctly.
See
Section 3.7 in the Essential Introduction for further information.
Dynamic memory allocation failed.
See
Section 3.6 in the Essential Introduction for further information.
7 Accuracy
The computational errors in the array
D should be negligible in most practical situations.
8 Parallelism and Performance
Not applicable.
The time taken by E01BEF is approximately proportional to .
The values of the computed interpolant at the points
, for
, may be obtained in the real array
PF, of length at least
M, by the call:
CALL E01BFF(N,X,F,D,M,PX,PF,IFAIL)
where
N,
X and
F are the input parameters to E01BEF and
D is the output parameter from E01BEF.
The values of the computed interpolant at the points
, for
, together with its first derivatives, may be obtained in the real arrays
PF and
PD, both of length at least
M, by the call:
CALL E01BGF(N,X,F,D,M,PX,PF,PD,IFAIL)
where
N,
X,
F and
D are as described above.
The value of the definite integral of the interpolant over the interval
A to
B can be obtained in the real variable
PINT by the call:
CALL E01BHF(N,X,F,D,A,B,PINT,IFAIL)
where
N,
X,
F and
D are as described above.
10 Example
This example reads in a set of data points, calls
E01BEF to compute a piecewise monotonic interpolant,
and then calls
E01BFF to evaluate the interpolant at equally spaced points.
10.1 Program Text
Program Text (e01befe.f90)
10.2 Program Data
Program Data (e01befe.d)
10.3 Program Results
Program Results (e01befe.r)