The option
Method->NIntegrate uses Cauchy's integral formula to compute derivatives:
The equivalent computation can be performed using
NResidue:
Mathematica has built-in code to compute derivatives of numerical functions:
The built-in numerical derivative code can be used. However, it is unable to capture the rapid oscillations:
Using
ND with the appropriate options can compute an accurate derivative:
Adding an additional definition for
f allows
ND to compute the derivative:
In this case,
Method->NIntegrate produces a more accurate answer: