Centered First Derivatives

If we take the difference between #tex2html_wrap_inline591# and #tex2html_wrap_inline593#, we find that all of the even order derivative terms in the Taylor expansion cancel out, leaving the following result:

#equation394#

Solving for the first derivative then yields the result:

#equation405#

Note that this approximation is second order accurate in dx. It uses one point to the right and one point to the left of the point where the derivative is evaluated. Only two values of f are needed, as with the forward and backward formulae. So, we can get better accuracy without using more data. Since the data used are symmetrically placed relative to where the derivative is computed, this formula is called a centered difference approximation. In practice, this formula is quite widely used. It is a workhorse of computational physics. As with the forward and backward formulae, we note that the centered difference formula would be exact if the underlying function had a vanishing third derivative. This implies that the function would necessarily have to be a quadratic function #tex2html_wrap_inline599#. While we do not know that the function has this property, our result above for this centered difference approximation indicates that our approximating an unknown function with a quadratic is a better approximation by a whole order of accuracy. This in not very surprising. Surely, the more terms in the Taylor series we include the better we should be able to capture the behavior of the function. Our remarks above about the problem with the forward and backward formulae at the points i=0 and i=N also apply to this centered difference approximation: At i=0 one needs #tex2html_wrap_inline607# while at i=N one needs #tex2html_wrap_inline611#, both of which do not exist as part of the original data. What to do? Well, we can develop one-sided second order accurate formulae without too much trouble. For example, let's construct a second order expression for the first derivative at #tex2html_wrap_inline613# using only data with i ;SPMgt; 0. For this purpose we record the Taylor expansion at i=1,2 with base point at i=0. We have

#equation419#

#equation432#

Then, by inspecting these two expansions we easily see that the following combination will result in the terms which have second derivatives cancelling out.

#equation444#

Solving for the first derivative we find

#equation453#

Thus we have constructed a second order accurate derivative approximation which is defined at the leftmost end point of the defined data. The same method could be used to generate a second order derivative defined at the rightmost end of the given data.