SplineInterpolation1D — Class for performing spline interpolations between data points from a one-dimensional data set.
Constructor for the SplineInterpolation1D object.
A SplineInterpolation1D object provides the following methods:
__call__(x): Calculate and return the spline interpolation at x,
i.e. f(x) where
f is a SplineInterpolation1D object.
derivatives(x): Calculate and return a tuple containing the derivatives (f, df/dx, d2f/dx2) of the spline interpolation evaluated at x.
Define a spline interpolation of the sin function
x = numpy.linspace(-4,9,20) y = numpy.sin(x) f = SplineInterpolation1D(x,y)
Using the function we obtain
>>> print f(3)
0.141203196688
>>> print f.derivatives(3)
(0.14120319668785397, -0.98998913849695858, -0.14589372176098986)
>>> print numpy.array(f.derivatives(3)) - \
numpy.array((numpy.sin(3), numpy.cos(3), -numpy.sin(3)))
[ 8.31886280e-05 3.35810349e-06 -4.77371370e-03]