DEFINITION MODULE CubicSplines; (* This Module implements the cubic splines. See "Numerical Methods for Scientists and Engineers" by R. W. Hamming, page 349. Currently, a set of 100 data points can spline fitted. This limitation will be removed in the future. *) EXPORT QUALIFIED Spline,MakeSpline,EvalSpline,DerivSpline; TYPE Spline; (* hidden *) PROCEDURE MakeSpline( x : ARRAY OF REAL (* in *); y : ARRAY OF REAL (* in *); un: CARDINAL (* in *); VAR S : Spline (* out *) ) : BOOLEAN; (* This procedure takes the user x,y data and creates a cubic spline S. The x values must be increasing either in the direction x[1]..x[un] or x[un]..x[1] but must never be such that two x values overlap or cross. *) PROCEDURE EvalSpline( x : REAL (* in *); S : Spline (* in *); VAR val : REAL (* out *) ) : BOOLEAN; (* Evaluate spline S at x and return value in "val". If trouble, e.g, x is out of range, RETURN FALSE. *) PROCEDURE DerivSpline( x : REAL (* in *); S : Spline (* in *); VAR Deriv : REAL (* out *) ): BOOLEAN; (* Evaluates the derivative of the spline "S" at x. The function value returned is TRUE if ok, otherwise if x is out of range or if other problems occur, FALSE is returned. *) END CubicSplines.