# Derivative of an interpolated function

I am trying to take the derivative of an interpolated function. I am given the function values and the derivatives at some irregular points. Here is my minimal working example to reproduce the error:

i = Interpolation[Table[{{2 t}, Sin[t], Cos[t]}, {t, 0, 4, 0.01}]]
Plot[i[t], {t, 0, 4}]


Plot[i'[t], {t, 0, 4}]


Apparently the interpolation is working, but not the derivative. Is there something I am doing wrong or is this a bug?

Remember the chain rule. You feed Interpolation with very contradictory information: The first derivative does not fit the parameterization of the curve.

This works better:

i = Interpolation[Table[{{2 t}, Sin[t], 1/2 Cos[t]}, {t, 0., 4., 0.01}]];
GraphicsRow[{
Plot[i[t], {t, 0, 4}],
Plot[i'[t], {t, 0, 4}]
}]


Alternatively, you may use

i = Interpolation[Table[{{t}, Sin[t], Cos[t]}, {t, 0., 4., 0.01}]];

• @Mr.Wizard Of course you're right. I removed it. – Henrik Schumacher Mar 19 at 21:04

There is no error.

Given

f = Interpolation[Table[{{2 t}, Sin[t], Cos[t]}, {t, 0, 4, 0.01}]]


when you make the plot

Plot[f[t], {t, 0, 8}]


it looks like a nice smooth curve which should have a smooth derivative, but if you plot a small section of the domain, like this

Plot[f[t], {t, 0, .1}]


you see it is actually highly oscillatory, which explains your derivative plot.