XLPack 7.0
XLPack Numerical Library (Excel VBA) Reference Manual
Loading...
Searching...
No Matches

◆ Pchfd()

Sub Pchfd ( N As  Long,
X() As  Double,
F() As  Double,
D() As  Double,
Ne As  Long,
Xe() As  Double,
Fe() As  Double,
De() As  Double,
Info As  Long,
Optional Skip As  Boolean = False,
Optional Idxfd As  Long = 0,
Optional Incfd As  Long = 1 
)

Evaluation of function and derivative values for piecewise cubic Hermite (and cubic spline) interpolation

Purpose
This routine evaluates a piecewise cubic Hermite function and its first derivative at an array of points. May be used by itself for Hermite interpolation, or as an evaluator for Pchim, Pchic, Pchsp or Pchse.

If only function values are required, use Pchfe instead.
Parameters
[in]NNumber of data points (N >= 2)
[in]X()Array X(LX - 1) (LX >= N)
Independent variable values. The elements of X() must be strictly increasing.
[in]F()Array F(LF - 1) (LF >= Incfd*(N - 1) + 1)
Function values. F(Idxfd + I*Incfd) is the value corresponding to X(I) (I = 0 to N - 1).
[in]D()Array D(LD - 1) (LD >= Incfd*(N - 1) + 1)
Derivative values. D(Idxfd + I*Incfd) is the value corresponding to X(I) (I = 0 to N - 1).
[in]NeNumber of evaluation points. (Ne >= 1)
[in]Xe()Array Xe(LXe - 1) (LXe >= Ne)
Points at which the function is to be evaluated.
Note 1: The evaluation will be most efficient if the elements of Xe() are increasing relative to X(); that is, Xe(j) >= X(i) implies Xe(k) >= X(i) for all k >= j.
Note 2: If any of the Xe() are outside the interval [ X(0), X(n-1) ], values are extrapolated from the nearest extreme cubic, and a warning error is returned.
[out]Fe()Array Fe(LFe - 1) (LFe >= Ne)
Values of the cubic Hermite function defined by N, X(), F(), D() at the points Xe().
[out]De()Array De(LDe - 1) (LDe >= Ne)
Values of the first derivative of the cubic Hermite function defined by N, X(), F(), D() at the points Xe().
[out]Info= 0: Successful exit.
= -1: The argument N had an illegal value. (N < 2)
= -2: The argument X() is invalid or had an illegal value. (X() is not strictly increasing)
= -3: The argument F() is invalid.
= -4: The argument D() is invalid.
= -5: The argument Ne had an illegal value. (Ne < 1)
= -6: The argument Xe() is invalid.
= -7: The argument Fe() is invalid.
= -8: The argument De() is invalid.
= -12: The argument Incfd had an illegal value. (Incfd < 1)
= i > 0: Extrapolation was performed at i points.
[in]Skip(Optional)
Logical variable which should be set to True if the user wishes to skip checks for validity of preceding parameters, or to False otherwise. This will save time in case these checks have already been performed (say, in Pchim, Pchic, Pchsp or Pchse). (defaualt = False)
[in]Idxfd(Optional)
Index of the first data in F() and D(). (default = 0)
[in]Incfd(Optional)
Increment between successive values in F() and D(). (Incfd >= 1) (default = 1)
Reference
SLATEC (PCHIP)
Example Program
See example of Pchic.