Skip to main content
Mathematics LibreTexts

10.3: Truncation Error

  • Page ID
    90284
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    In the previous section we found a finite difference scheme for numerically solving the one dimensional heat equation. We have from Equations (10.2.5) and (10.2.7), \[\begin{align} u(x, t+\Delta t) & \approx u(x, t)+\alpha[u(x+\Delta x, t)-2 u(x, t)+u(x-\Delta x, t)] \label{eq:1}\\ u_{i, j+1} & \approx u_{i, j}+\alpha\left[u_{i+1, j}-2 u_{i, j}+u_{i-1, j}\right],\label{eq:2} \end{align}\] where \(\alpha=k \Delta t /(\Delta x)^{2}\). For points \(x \in[a, b]\) and \(t \geq 0\), we use the scheme to find approximate values of \(u\left(x_{i}, t_{i}\right)=u_{i, j}\) at positions \(x_{i}=a+i \Delta x, \quad i=\) \(0,1, \ldots, N\), and times \(t_{j}=j \Delta t, \quad j=0,1,2, \ldots\).

    In implementing the scheme we have found that there are errors introduced just like when using Euler’s Method for ordinary differential equations. These truncations errors can be found by applying Taylor approximations just like we had for ordinary differential equations. In the schemes \(\eqref{eq:1}\) and \(\eqref{eq:2}\), we have not use equality. In order to replace the approximation by an equality, we need t estimate the order of the terms neglected in a Taylor series approximation of the time and space derivatives we have approximated.

    We begin with the time derivative approximation. We used the forward difference approximation (10.2.1), \[\dfrac{\partial u}{\partial t} \approx \dfrac{u(x, t+\Delta t)-u(x, t)}{\Delta t} .\label{eq:3}\] This can be derived from the Taylor series expansion of \(u(x, t+\Delta t)\) about \(\Delta t=0\), \[u(x, t+\Delta t)=u(x, t)+\dfrac{\partial u}{\partial t}(x, t) \Delta t+\dfrac{1}{2 !} \dfrac{\partial^{2} u}{\partial t^{2}}(x, t)(\Delta t)^{2}+O\left((\Delta t)^{3}\right) .\nonumber \] Solving for \(\dfrac{\partial u}{\partial t}(x, t)\), we obtain \[\dfrac{\partial u}{\partial t}(x, t)=\dfrac{u(x, t+\Delta t)-u(x, t)}{\Delta t}-\dfrac{1}{2 !} \dfrac{\partial^{2} u}{\partial t^{2}}(x, t) \Delta t+O\left((\Delta t)^{2}\right) .\nonumber \] We see that we have obtained the forward difference approximation (10.2.1) with the added benefit of knowing something about the error terms introduced in the approximation. Namely, when we approximate \(u_{t}\) with the forward difference approximation (10.2.1), we are making an error of \[E(x, t, \Delta t)=-\dfrac{1}{2 !} \dfrac{\partial^{2} u}{\partial t^{2}}(x, t) \Delta t+O\left((\Delta t)^{2}\right) .\nonumber \] We have truncated the Taylor series to obtain this approximation and we say that \[\dfrac{\partial u}{\partial t}=\dfrac{u(x, t+\Delta t)-u(x, t)}{\Delta t}+O(\Delta t)\label{eq:4}\] is a first order approximation in \(\Delta t\).

    In a similar manor, we can obtain the truncation error for the \(u_{x} x\)-term. However, instead of starting with the approximation we used in Equation ??uxx), we will derive a term using the Taylor series expansion of \(u(x+\) \(\Delta x, t)\) about \(\Delta x=0\). Namely, we begin with the expansion \[\begin{align} u(x+\Delta x, t)=& u(x, t)+u_{x}(x, t) \Delta x+\dfrac{1}{2 !} u_{x x}(x, t)(\Delta x)^{2}+\dfrac{1}{3 !} u_{x x x}(x, t)(\Delta x)^{3}\nonumber \\ &+\dfrac{1}{4 !} u_{x x x x}(x, t)(\Delta x)^{4}+\ldots\label{eq:5} \end{align}\]

    We want to solve this equation for \(u_{x x}\). However, there are some obstructions, like needing to know the \(u_{x}\) term. So, we seek a way to eliminate lower order terms. On way is to note that replacing \(\Delta x\) by \(-\Delta x\) gives \[\begin{align} u(x-\Delta x, t)=& u(x, t)-u_{x}(x, t) \Delta x+\dfrac{1}{2 !} u_{x x}(x, t)(\Delta x)^{2}-\dfrac{1}{3 !} u_{x x x}(x, t)(\Delta x)^{3}\nonumber \\ &+\dfrac{1}{4 !} u_{x x x x}(x, t)(\Delta x)^{4}+\ldots\label{eq:6} \end{align}\] Adding these Taylor series, we have \[\begin{align} u(x+\Delta x, t)+u(x+\Delta x, t)=& 2 u(x, t)+u_{x x}(x, t)(\Delta x)^{2}\nonumber \\ &+\dfrac{2}{4 !} u_{x x x x}(x, t)(\Delta x)^{4}+O\left((\Delta x)^{6}\right) .\label{eq:7} \end{align}\]

    We can now solve for \(u_{x x}\) to find \[\begin{align} u_{x x}(x, t)=& \dfrac{u(x+\Delta x, t)-2 u(x, t)+u(x+\Delta x, t)}{(\Delta x)^{2}}\nonumber \\ &+\dfrac{2}{4 !} u_{x x x x}(x, t)(\Delta x)^{2}+O\left((\Delta x)^{4}\right)\label{eq:8} \end{align}\] Thus, we have that \[u_{x x}(x, t)=\dfrac{u(x+\Delta x, t)-2 u(x, t)+u(x+\Delta x, t)}{(\Delta x)^{2}}+O\left((\Delta x)^{2}\right)\nonumber \] is the second order in \(\Delta x\) approximation of \(u_{x x}\).

    Combining these results, we find that the heat equation is approximated by \[\dfrac{u(x, t+\Delta t)-u(x, t)}{\Delta t}=\dfrac{u(x+\Delta x, t)-2 u(x, t)+u(x+\Delta x, t)}{(\Delta x)^{2}}+O\left((\Delta x)^{2}, \Delta t\right) .\nonumber \] This has local truncation error that is first order in time and second order in space.


    This page titled 10.3: Truncation Error is shared under a CC BY-NC-SA 3.0 license and was authored, remixed, and/or curated by Russell Herman via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.

    • Was this article helpful?