[SciPy-User] Gradient of spline interpolation at a point wrt changing the knot points

Pauli Virtanen pav at iki.fi
Fri Jun 14 17:47:05 EDT 2013


Pauli Virtanen <pav <at> iki.fi> writes:
> John Salvatier <jsalvatier <at> gmail.com> writes:
> > 
> > I'm using scipy.interpolate.InterpolatedUnivariateSpline in a statistical 
> application. 
> > y = InterpolatedUnivariateSpline(x0,y0)(x)
> > 
> > I need the derivatives of the spline evaluated at 
> > a given point with respect to changing the knot values (y0).
> >  That is, I need the derivative of y wrt to y0. Is there
> > a way I could compute this?
> 
> You can work it out from the B-spline representation:
> 
> https://github.com/pv/scipy-work/blob/spline-
> unify/scipy/interpolate/_bspline.py#L29
> 
> Not that there is ready-made code for it, but it should be
> possible to write it.

Sorry, wrote it too fast. Computing the spline coefficients 
is IIRC is a global process, and it is affected by knot locations,
so I doubt there is a simple formula for the derivative.

-- 
Pauli Virtanen




More information about the SciPy-User mailing list