Hello Henrik. The substitution of x by 45 degrees occurs after computing the derivative of Cos[x], which is equal to -Sin[x]..
D[ex, x] /. x -> 45 \[Degree] // N
Which returns:
-0.707107
However, the number 46 is equivalent to x=45 degrees in the interpolated function and, in my opinion, d’[46] should return the value of the derivative of Cos[x] for x=45 degrees.
Well, I see your point. But you did not interpolate Cos[x] but Cos[x \[Degree]]. So when you want to get the same results, you rather have to calculate ``d’[46]/[Degree]} // N``` - that I tried to indicate with my first answer.
I don’t know what you wanted as the correct result. The way you have set up your Interpolation, its domain is the interval [1, 361] of the reals, and knows nothing of degrees. This way the two derivatives agree:
f = Interpolation[Table[{x, Cos[x]}, {x, 0 °, 360 °, 1 °}],
InterpolationOrder -> 6]
f'[45 °] // N