Mathematica has two ways to integrate:
But what about
Derivative are for symbolic differentiation.
How can I differentiate numerically?
As others mentioned, there's the
It's a bit less widely known that
Let's create a numerical black box function:
Update: Please also see a discussion by @acl concluding that the difference between
There are two rather different scenarios for numerical derivatives:
For scenario 1, here is an example function and its derivative:
For scenario 2, here I discretize the above function to get a table of values in some interval:
Now the derivative can be taken using
Here, I took the list
After doing the derivative, I remove the padding by using a negative argument in
Both approaches are easily generalized; the Lanczos method can be generalized to arbitrary integer-order derivatives, and the Cauchy method can be generalized to arbitrary complex-order derivatives. I won't be discussing these generalizations further in this answer, tho.
It's not too hard to implement the Richardsonian method I alluded to in my MO answer, but the routine is somewhat longer; I'll edit this answer to include it if there's interest.