3.5. Finite difference formulas for the 2nd derivative#
One way of establishing schemses for the 2nd derivative, such as the term \(\frac{\partial^2 u}{\partial x^2}\) in the Diffusion equation (10.1), is to manipulate Taylor series in varous ways. This method for finding the schemes, also provides us with the error terms that indicate the scheme order. We typically start with Taylor series for \(u^{n+1}\) and \(u^{n-1}\), but you can invoke \(u\) at other time steps (or space steps).
We start from the Taylor expansion in Equation (3.4), repeated here with Leibnitz difference notation:
We now insert \(t=n+1\) to achieve the Taylor expansion for \(u^{n+1}\) and insert \(t=n-1\) to get the expansion for \(u^{n-1}\).
It is also possible to invoke more values of \(u\) at earlier or later time step.
3.5.1. Centered formula#
If you compare the two expressions in Equation (3.21), you may. notice that all the terms are the same. The only thing that separates the two expressions, are the signs in front of every second term. We are interested in finding a scheme for the second order derivative, which we find in the third term on the right hand side. We would also like to get rid of the term with the first derivative (second term on the right hand side). The trick now is to add these two equations together. Then we cancel out the first derivative terms, and keep the second derivative. We can collect the remaining terms on either side of the equals sign.
Solving Equation (3.22) for the second derivative, we get:
Centered scheme for the 2nd derivative:
This is a second order three-point centered formula for the second derivative.
3.5.2. Forward formula#
You can obtain a forward formula using the same procedure as for the centered formula. To do so, we must start with the Taylor expansions for \(u^{n+1}\) and \(u^{n+2}\):
To end up with an expression that cancels out the first derivatives, we can take the expression for \(u^{n+2}\) and subract 2 times the expression for \(u^{n+1}\). Solving for the second derivative, we obtain:
Forward scheme for the 2nd derivative:
This is a forst order three-point forward formula for the second derivative. It is less used than the centered formula, since the error is typically higher for a first order formula.
