These formulas below approximate \(u^{\prime }\) at \(x=x_{j}\) where \(j\) is the grid point number.
formula | truncation | Truncation | common name and | |
error | error order | common notation | ||
1 | \(u_{j}^{\prime }\approx \frac {1}{h}\left ( u_{j+1}-u_{j}\right ) \) | \(-u_{j}^{\prime \prime }\frac {h}{2}-u_{j}^{\left ( 3\right ) }\frac {h^{2}}{3!}-\cdots \) | \(O\left ( h\right ) \) | one point forward \(D_{+}\) |
2 | \(u_{j}^{\prime }\approx \frac {1}{h}\left ( u_{j}-u_{j-1}\right ) \) | \(u_{j}^{\prime \prime }\frac {h}{2}-u_{j}^{\left ( 3\right ) }\frac {h^{2}}{3!}+\cdots \) | \(O\left ( h\right ) \) | one point backward \(D_{\_}\) |
3 | \(u_{j}^{\prime }\approx \frac {1}{2h}\left ( u_{j+1}-u_{j-1}\right ) \) | \(-u_{j}^{\left ( 3\right ) }\frac {h^{2}}{6}-u_{j}^{\left ( 6\right ) }\frac {h^{5}}{6!}-\cdots \) | \(O\left ( h^{2}\right ) \) | centered difference, \(D_{0}=\frac {D_{+}+D_{\_}}{2}\) |
4 | \(u_{j}^{\prime }\approx \frac {1}{h}\left ( \frac {3}{2}u_{j}-2u_{j+1}+\frac {1}{2}u_{j+2}\right ) \) | to do | \(O\left ( h^{2}\right ) \) | 3 points forward difference |
5 | \(u_{j}^{\prime }\approx \frac {1}{6}\left ( 2u_{j+1}+3u_{j}-6u_{j-1}+u_{j-2}\right ) \) | to do | \(O\left ( h^{3}\right ) \) | |
For example, to obtain the third formula above, we start from Taylor series and obtain\[ u_{j+1}=u_{j}+hu_{j}^{\prime }+\frac {h^{2}}{2!}u_{j}^{\prime \prime }+\frac {h^{3}}{3!}u_{j}^{\prime \prime \prime }+\cdots \] then we write it again for the previous point\[ u_{j-1}=u_{j}-hu_{j}^{\prime }+\frac {h^{2}}{2!}u_{j}^{\prime \prime }-\frac {h^{3}}{3!}u_{j}^{\prime \prime \prime }\cdots \] Notice the sign change in the expressions. We now subtract the second formula above from the above resulting in\[ u_{j+1}-u_{j-1}=2hu_{j}^{\prime }+2\frac {h^{3}}{3!}u_{j}^{\prime \prime \prime }+\cdots \] Or\begin {align*} u_{j+1}-u_{j-1} & =2hu_{j}^{\prime }+2\frac {h^{3}}{3!}u_{j}^{\prime \prime \prime }+\cdots \\ \frac {u_{j+1}-u_{j-1}}{2h} & =u_{j}^{\prime }+\overset {O(h^{2})\text { error}}{\overbrace {h^{2}\frac {u_{j}^{\prime \prime \prime }}{3!}+\cdots }} \end {align*}
These formulas below approximate \(u^{\prime \prime }\) at \(x=x_{j}\) where \(j\) is the grid point number. For approximation to \(u^{\prime \prime }\) the accuracy of the approximation formula must be no less than \(2\).
formula | truncation | Truncation | common name | |
error | error order | |||
1 | \(u_{j}^{\prime \prime }\approx \frac {1}{h^{2}}\left ( U_{j-1}-2U_{j}+U_{j+1}\right ) \) | \(-u^{\left ( 4\right ) }\frac {h^{2}}{12}-u^{\left ( 6\right ) }\frac {h^{4}}{360}-\cdots \) | \(O\left ( h^{2}\right ) \) | 3 points centered difference |
To obtain the third formula above, we start from Taylor series. This results in\[ u_{j+1}=u_{j}+hu_{j}^{\prime }+\frac {h^{2}}{2!}u_{j}^{\prime \prime }+\frac {h^{3}}{3!}u_{j}^{\prime \prime \prime }+\frac {h^{4}}{4!}u_{j}^{\prime \prime \prime \prime }\cdots \] Then we write it again for the previous point\[ u_{j-1}=u_{j}-hu_{j}^{\prime }+\frac {h^{2}}{2!}u_{j}^{\prime \prime }-\frac {h^{3}}{3!}u_{j}^{\prime \prime \prime }+\frac {h^{4}}{4!}u_{j}^{\prime \prime \prime \prime }\cdots \] Notice the sign change in the expressions. We now add the second formula above from the above resulting in\begin {align*} u_{j+1}+u_{j-1} & =2u_{j}+2h^{2}u_{j}^{\prime \prime }+2\frac {h^{4}}{4!}u_{j}^{\prime \prime \prime \prime }+\cdots \\ \frac {u_{j-1}-2u_{j}+u_{j-1}}{2h^{2}} & =u_{j}^{\prime \prime }+\overset {O(h^{2})\text { error}}{\overbrace {h^{2}\frac {u_{j}^{\prime \prime \prime }}{4!}+\cdots }} \end {align*}