Numerical Recipes applied

Cubic Spline interpolation

Cubic Spline interpolation between each data pair xi, xi+1 is done through a third-grade polynomial function, under the condition that the function f(x), as well as its first and second derivatives f(x)1 and f(x)2, have to be continuum in the limits of the interval.



and, if the third-order derivative is written as a function of the second-order derivative,


where h is:


and the continuity conditions:


The files for this calculation are in folder breitwigner/2_CubicSplines. It uses the Numerical Recipes libraries, spline.c and splint.c.

The program splinesc.c is very similar to lagrange.c and works in a similar way as explained in the Lagrange interpolations page.

Once we have all the inputs, we can call the spline() function (you may want to check the definition again) and then we call splint() inside a loop through the points (See the definition).

	 * Calculating the first derivative,
	 * evaluating in E1 and E1 and
	 * calling the functions
	yp1 = -0,00001;
	ypn = -0,5;
	spline(xa, ya, N, yp1, ypn, y2);
	for (i=1; i<=n; i++)
		splint(xa, ya, y2, N, x[i], &y[i]);


And so the following values are obtained:

The region of the curve where there is more variation is the peak, that's why we take more points there. Repeat the calculation adding points for the rest of the curve.

Breit-Wigner curve obtained with Cubic splines

The peak is the region of higher variation of the curve.

Breit-Wigner curve obtained with Cubic splines. Zoom in

Zoom in of the previous plot.