# Derivative of Interpolation parameters

I am working with interpolation function with some non-numerical arguments. A simplified version of the function I am working with is:

FUNC = Interpolation[{{0, a}, {1, b}, {2, c}}]


I would like to compute the derivative of FUNC with respect to a, b and c (for a general function value)

Potential solution: obtain the piecewise function that Interpolation generates. Problem: I do not know how to extract this piecewise function from FUNC.

• Is not it the same as computing a derivative of the interpolating function? Sep 27 '16 at 8:52
• No. Typically, the derivative would be FUNC'[x]. However, I do not want dFUNC/dx, but dFUNC/da, where a is one of the parameters specified above. Sep 27 '16 at 8:56
• The piecewise function that the interpolating function represents depends on the interpolation method and the data. Here is one way: mathematica.stackexchange.com/a/59963/4999 Sep 27 '16 at 10:23
• This makes no sense because this derivative is not defined by your data unless it contains {0,a} and {0,a+some value}. Mar 25 '18 at 17:49

f[a_, b_, c_] = Interpolation[
{{0, a}, {1, b}, {2, c}},
InterpolationOrder -> 2];

xValues = Range[0, 2, 1/8];

fValues = f[a, b, c] /@ xValues // Simplify;

dfda[x_] = InterpolatingPolynomial[
{xValues, D[#, a] & /@ fValues} // Transpose, x] //
Simplify

(*  1/2 (2 - 3 x + x^2)  *)

Plot[dfda[x], {x, 0, 2},
Frame -> True,
FrameLabel -> (Style[#, 14, Bold] & /@
{"x", "df / da"})] EDIT: As Breugem suggested in his comment to this answer, working directly with the InterpolatingPolynomial is more straightforward.

fp[a_, b_, c_, x_] =
InterpolatingPolynomial[{{0, a}, {1, b}, {2, c}}, x] // Simplify

(*  a + (-a + b + 1/2 (a - 2 b + c) (-1 + x)) x  *)

D[fp[a, b, c, x], a] // Simplify

(*  1/2 (2 - 3 x + x^2)  *)

• This is very good! The interpolating polynomial will become complex for large grids, in which a piecewise polynomial needs to be estimated, which brings us back to the original problem. I guess the most efficient way would be to generate an interpolating polynomial from the start Sep 27 '16 at 12:15
• @Breugem Using an interpolating polynomial on more than a few points is usually a bad idea, unless your data is exact and you know a polynomial is an appropriate model. Piecewise interpolation is usually more appropriate. Sep 27 '16 at 13:12
• I agree:) This was my (potentially unclear) comment (i.e., we cannot use the InterpolatingPolynomial from the answer above) Sep 27 '16 at 13:50