Numerical Differentiation
In this section we use various schemes for approximating derivatives, using discrete points, starting from the first-order divided difference approximation
This is a two-point formula, for the approximation, relying on points and . If we can use two points, can't we use three to get even better approximations? Of course we can!
forward-difference formula: h>0; backward-difference formula: h<0.
But what error are we making in that approximation? Well, if f is twice differentiable, then this approximation will fall out of the Lagrange interpolating polynomial and its error term. Consider two points and , and the linear Lagrange interpolating polynomial. Define . Then
Then
The Newton form of the interpolating polynomial (which is equivalent to the Lagrange interpolating polynomial, remember!) gives us the derivative as the divided difference, and then we have to use the product rule to produce the mess with the rest:
When we get some nice simplification: we have that
so, in general, the forward (or backward) difference approximations have errors that satisfy
where M>0 is a bound on the size of the second derivative on the interval .
We can get the error bound for the centered-difference formula using Taylor series quite easily, provided f is thrice-differentiable:
and
Then the centered-difference formula yields
and, provided f''' is continuous, we can find a such that
so that
Marvellous! Don't you love that Taylor formula?