Numerical differentiation: Difference formulas for the second derivative
General difference formulas for the second derivative
The general approach for different grid points , which differ by a multiple of step size , is to find coefficients such that the expression
approximates the second derivative with the largest possible order of the truncation error. We find the coefficients by developing each into a Taylor polynomial about with sufficiently high degree and by constructing and solving equations for the unknown 's.
The 3-point central formula We take 3 grid points , and . We define the formula
and determine the Taylor approximation of . We know that
Therefore:
The equations that must satisfy in order to maximise the order of the error in are
These equations are easy to solve:
So we have now found
and
This is equal to the earlier found central difference formula for the second derivative. It can be verified that the truncation error is of the order of .
One-sided 3-point formulas Left-sided 3-point difference formula:
Right-sided 3-point difference formula:
These one-sided 3-point difference formulas are useful to approximate second derivatives at the edges of a finite discrete signal.
We take 3 grid points , and . We define the formula
and determine the Taylor approximation of . We know that
Thus:
The equations that must satisfy in order to maximise the order of the error in are
These equations are easy to solve:
So now we have found
and
This is a left sided 3 point difference formula. Similarly, you can also find the right-tailed 3-point difference formula:
Central 5-point difference
The truncation error is generally smaller than with the central 3-point difference formula.
We take 5 grid points , , , and . We define the formula
and determine the Taylor approximation of . There is
and therefore
The equations that must satisfy in order to maximise the order of the error in are
These equations are relatively easy to solve:
So we have found that
and
This is the 5-point central difference formula.
Unlock full access