[SciPy-User] Gradient of spline interpolation at a point wrt changing the knot points
Daπid
davidmenhur@gmail....
Fri Jun 14 18:03:09 CDT 2013
On 14 June 2013 23:47, Pauli Virtanen <pav@iki.fi> wrote:
> 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.
Actually, it only depends on the surrounding points, and with linear
properties. See, for example, its matrix form [1]: a multi-diagonal
fixed matrix A multiplying a vector of coefficients b.
A b = y
So, one could solve the vector of coeficients:
b = A^-1 y
Now, the definition of derivative with respect to y_i (the value of y
at point i):
d b/dy_i = limit h->0 ((A^-1 (y + h)-A^-1 y)/h) = limit h->0 A^-1 h /h
where h = [0, 0 .... h ....0] in the i-th position. And this is the
sum of the i-th row of the matrix. In the case of cubic interpolation,
that would be 0.507 for any point not in the borders or next to one.
David.
[1] Formula 9: http://www.mechanicaldust.com/UCB/math128a/cubic.pdf
More information about the SciPy-User
mailing list