CUBICSPLINE - Functions to compute CUBIC SPLINE interpolation coefficients cakima compute cubic spline coefficients via Akima's method (continuous 1st derivatives, only) cmonot compute cubic spline coefficients via the Fritsch-Carlson method (continuous 1st derivatives, only) csplin compute cubic spline coefficients for interpolation (continuous 1st and 2nd derivatives) Function Prototypes: void cakima (int n, float x[], float y[], float yd[][4]); void cmonot (int n, float x[], float y[], float yd[][4]); void csplin (int n, float x[], float y[], float yd[][4]); Input: n number of samples x array[n] of monotonically increasing or decreasing abscissae y array[n] of ordinates Output: yd array[n][4] of cubic interpolation coefficients (see notes) Notes: The computed cubic spline coefficients are as follows: yd[i][0] = y(x[i]) (the value of y at x = x[i]) yd[i][1] = y'(x[i]) (the 1st derivative of y at x = x[i]) yd[i][2] = y''(x[i]) (the 2nd derivative of y at x = x[i]) yd[i][3] = y'''(x[i]) (the 3rd derivative of y at x = x[i]) To evaluate y(x) for x between x[i] and x[i+1] and h = x-x[i], use the computed coefficients as follows: y(x) = yd[i][0]+h*(yd[i][1]+h*(yd[i][2]/2.0+h*yd[i][3]/6.0)) Akima's method provides continuous 1st derivatives, but 2nd and 3rd derivatives are discontinuous. Akima's method is not linear, in that the interpolation of the sum of two functions is not the same as the sum of the interpolations. The Fritsch-Carlson method yields continuous 1st derivatives, but 2nd and 3rd derivatives are discontinuous. The method will yield a monotonic interpolant for monotonic data. 1st derivatives are set to zero wherever first divided differences change sign. The method used by "csplin" yields continuous 1st and 2nd derivatives. References: See Akima, H., 1970, A new method for interpolation and smooth curve fitting based on local procedures, Journal of the ACM, v. 17, n. 4, p. 589-602. For more information, see Fritsch, F. N., and Carlson, R. E., 1980, Monotone piecewise cubic interpolation: SIAM J. Numer. Anal., v. 17, n. 2, p. 238-246. Also, see the book by Kahaner, D., Moler, C., and Nash, S., 1989, Numerical Methods and Software, Prentice Hall. This function was derived from SUBROUTINE PCHEZ contained on the diskette that comes with the book. For more general information on spline functions of all types see the book by: Greville, T.N.E, 1969, Theory and Applications of Spline Functions, Academic Press. Author: Dave Hale, Colorado School of Mines c. 1989, 1990, 1991