The SPL_INIT function is called to establish the type of interpolating spline for a tabulated set of functional values Xi, Yi = F(Xi).

It is important to realize that SPL_INIT should be called only once to process an entire tabulated function in arrays X and Y. Once this has been done, values of the interpolated function for any value of X can be obtained by calls (as many as desired) to the separate function SPL_INTERP.

Examples


Example 1

X = (FINDGEN(21)/20.) * 2.0*!PI
Y = SIN(X)
PRINT, SPL_INIT(X, Y, YP0 = -1.1, YPN_1 = 0.0)

IDL Prints:

23.1552    -6.51599    1.06983   -1.26115  -0.839544    -1.04023
-0.950336  -0.817987  -0.592022  -0.311726  2.31192e-05  0.311634
 0.592347   0.816783   0.954825   1.02348   0.902068     1.02781
-0.198994   3.26597  -11.0260

Example 2

PRINT, SPL_INIT(X, Y, YP0 = -1.1)

IDL prints:

23.1552    -6.51599    1.06983   -1.26115  -0.839544    -1.04023
-0.950336  -0.817988  -0.592020  -0.311732  4.41521e-05  0.311555
 0.592640   0.815690   0.958905   1.00825   0.958905     0.815692
 0.592635   0.311567   0.00000

Syntax


Result = SPL_INIT( X, Y [, /DOUBLE] [, YP0=value] [, YPN_1=value] )

Return Value


Returns the values of the 2nd derivative of the interpolating function at the points Xi.

Arguments


X

An n-element input vector that specifies the tabulate points in ascending order.

Y

An n-element input vector that specifies the values of the tabulated function F(Xi) corresponding to Xi.

Keywords


DOUBLE

Set this keyword to force the computation to be done in double-precision arithmetic.

YP0

The first derivative of the interpolating function at the point X0. If YP0 is omitted, the second derivative at the boundary is set to zero, resulting in a “natural spline.”

YPN_1

The first derivative of the interpolating function at the point Xn-1. If YPN_1 is omitted, the second derivative at the boundary is set to zero, resulting in a “natural spline.”

Version History


4.0

Introduced

Resources and References


SPL_INIT is based on the routine spline described in section 3.3 of Numerical Recipes in C: The Art of Scientific Computing (Second Edition), published by Cambridge University Press, and is used by permission.

See Also


SPL_INTERP, SPLINE, SPLINE_P