Spline fitting

 

1.      ..\..\interpolation\Cubic Spline Interpolation.doc Press’s presentation of the codes SPLINE.FOR and SPLINT.FOR.  These use x, y, and y” to interpolate a set of data points.  The y” is solved for by requiring continuity of the first derivatives.  A part labeled Bob’s thoughts flirts with midpoint knots, picture showing effects of end point derivatives.

2.       doc1/ypp.htm .doc – Bob’s Lagrange derivation of the Press result -- details the Lagrange interpolation of y and y”, produces the same results as doc1/Cubic Spline Interpolation.htm .doc based on Press 

3.      doc1/The two forms.htm .doc Detailed derivation of YPPTOC.FOR for converting x,y,y” to sum on c and d terms. 


The partials with respect to cj, dk, and xk are easy to evaluate in this form making it appropriate for fitting the data
This code is used in CNMFIT.FOR (this is code from bkgfit that needs to be modified and simplified for use in class)

4.       doc1/Fitting Sections.htm .doc. Considers the boundary conditions for fitting data in short sections.  doc1\Fitting Sections 2.htm .doc A bit more detail.  In fact the fitting method actually used was to vary a knot, the six above it and the six below it.  The knots were moved toward lower channels 2 knots at a time.  The idea is that the top two knots and the bottom 2 represent the boundary conditions, while the rest are local.  In fact, the non-local effect of each knot on regions much lower is probably the primary reason for the method working.  The fact that this limits the number of constants to 26 makes the matrix invertible which possibly is more important than any other consideration. 

5.       doc1/Alpha for bkg.htm .doc  The notion that the error should be increased introduced in the general reference above is implemented here by solving for alpha such that 2N=(f-fA)**2/((alpha*f)**2+e2)

6.      doc1/Adding knots.htm  .doc A penalty is added to keep knots from drifting outside the fitting region.

Fortran codes

12/22/2004  09:13 AM            13,048 CNMFIT.FOR  -- from bkgfit – fits spline constants, vary’s knots.

01/03/2005  04:56 AM               251 DERSPL.FOR --- version of splint that also returns the derivative of the spline

11/12/2004  07:46 PM               960 SPLINE.FOR  --- given as set of x, y values, this code based on Press solvefs for y’’ for later use by splint.

01/03/2005  04:44 AM             1,207 SPLINT.FOR  --- based on Press uses the set x,y,y’’ to return the value of a spline at xbar.

08/11/2004  08:49 AM             1,132 TESTB.FOR – referred to in “Fitting Sections” above.

01/03/2005  04:55 AM               259 TSPLINE.FOR  -- evaluates the more traditional sum form of a spline.

08/06/2004  01:07 PM             2,070 xspline.for  -- used to test the two spline forms.

01/03/2005  04:53 AM               669 YPPTOC.FOR  -- converts x,y,y’’ spline form to a sum of constants form.