Skip to main content

Section 4.13 Review of Chapter 4

Subsection 4.13.1 Initial Value Problems

Subsubsection 4.13.1.1 Reduction to First order system:

For an \(n\)-th order equation that can be solved for the \(n\)-th derivative
\begin{equation*} x^{(n)}= f\left(t,x,\dot{x},\ddot{x}, \ldots, \frac{d^{n-1}x}{dt^{n-1}}\right) \end{equation*}
use the standard change of variables:
\begin{equation*} \begin{split}y_{1}&= x\\ y_{2}&= \dot{x}\\&\vdots \\ y_{n}&= x^{(n-1)}= \frac{d^{n-1}x}{dt^{n-1}}\end{split}\text{.} \end{equation*}
Differentiating results in a first-order system:
\begin{equation*} \begin{split}\dot{y}_{1}&= \dot{x}= y_{2}\\ \dot{y}_{2}&= \ddot{x}= y_{3}\\&\vdots \\ \dot{y}_{n}&= x^{(n)}= f(t,y_{1},y_{2},\ldots,y_{n})\end{split}\text{.} \end{equation*}

Subsubsection 4.13.1.2 Euler’s method:

\begin{equation*} \yb_{i+1}= \yb_{i} + h f(t_{i},\yb_{i}) \end{equation*}

Subsubsection 4.13.1.3 Modified (or Improved) Euler method:

\begin{equation*} \begin{split}\mathbf{k}_{1}&= h f(t_{i},\yb_{i})\\ \mathbf{k}_{2}&= h f(t_{i}+h, \yb_{i} + \mathbf{k}_{1})\\ \yb_{i+1}&= \yb_{i} + \frac{1}{2}\left(\mathbf{k}_{1} + \mathbf{k}_{2} \right)\end{split} \end{equation*}

Subsection 4.13.2 Boundary Value Probems

Subsubsection 4.13.2.1 Finite Differences:

Replace the Differential Equation by Difference Equations on a grid. Review the section on Numerical Differentiation.

Subsubsection 4.13.2.2 Explicit Method Finite Differences for Parabolic PDE (heat):

\begin{equation*} u_{t} \mapsto \frac{u_{i,j+1}- u_{ij}}{k}\quad\text{and}\quad u_{xx}\mapsto \frac{u_{i-1,j}- 2 u_{ij}+ u_{i+1,j}}{h^{2}} \end{equation*}
leads to
\begin{equation*} u_{i,j+1}= r u_{i-1,j}+ (1 - 2r) u_{i,j}+ r u_{i+1,j}\text{,} \end{equation*}
where \(h = L/m\text{,}\) \(k = T/n\text{,}\) and \(r ={ck}/{h^2}\text{.}\) The stability condition is \(r<1/2\text{.}\)

Subsubsection 4.13.2.3 Implicit Method Finite Differences for Parabolic PDE (heat):

\begin{equation*} u_{t} \mapsto \frac{u_{i,j+1}- u_{ij}}{k}\quad\text{and}\quad u_{xx}\mapsto \frac{u_{i+1,j+1}- 2 u_{i,j+1}+ u_{i-1,j+1}}{h^{2}} \end{equation*}
leads to
\begin{equation*} u_{i,j}= -r u_{i-1,j+1}+ (1+2r) u_{i,j+1}- r u_{i+1,j+1}\text{,} \end{equation*}
which is always stable and has truncation error \(O(h^{2}+k)\text{.}\)

Subsubsection 4.13.2.4 Crank-Nicholson Method Finite Differences for Parabolic PDE (heat):

\begin{equation*} -r u_{i-1,j+1}+ 2(1+r) u_{i,j+1}- r u_{i+1,j+1}= r u_{i-1,j}+ 2(1-r) u_{i,j}+ r u_{i+1,j}\text{,} \end{equation*}
which is always stable and has truncation error \(O(h^{2}+k^{2})\text{.}\)

Subsubsection 4.13.2.5 Finite Difference Method for Elliptic PDEs:

\begin{equation*} u_{xx}+ u_{yy}= f(x,y) \mapsto \frac{u_{i+1,j}- 2u_{ij}+ u_{i-1,j}}{h^{2}}+ \frac{u_{i,j+1}- 2u_{ij}+ u_{i,j-1}}{k^{2}}= f(x_{i},y_{j}) = f_{ij} \end{equation*}

Subsubsection 4.13.2.6 Finite Elements:

Based on triangles instead of rectangles. Can be used for irregularly shaped objects. An element: Pyramid shaped function at a node. A finite element solution is a linear combination of finite element functions:
\begin{equation*} U(x,y) = \sum_{j=1}^{n} C_{j} \Phi_{j}(x,y)\text{,} \end{equation*}
where \(n\) is the number of nodes, and where \(U\) is an approximation of the true solution. \(C_{j}\) is the value of the solution at node \(j\text{.}\) \(C_{j}\) at the boundary nodes are given by boundary conditions. \(C_{j}\) at interior nodes are determined by variation principles. The last step in determining \(C_{j}\)’s is solving a linear system of equations.

Subsection 4.13.3 MATLAB

Initial value problem solver that uses the Runge-Kutta 45 method, which has error \(O(h^{5})\) . The input \(y0\) is the initial vector and tspan is the time span. You can either make \(f\) a vector valued anonymous function and do
>> df = @(t,y)[-y(2);y(1)]
>> [T Y ] = ode45(dy,tspan,y0)
or make a function program that outputs a vector
function dy = myf(t,y) 
  dy = [-y(2);y(1)]; 
end
and then do
>> [T Y ] = ode45(@myf,tspan,y0)
The program ode45 and other MATLAB IVP solvers use adaptive step size to achieve a desired local and global accuracy, with a default of tol \(=10^{-6}\) for the global error.
The chief benefit of higher order methods and variable step size is that they allow a program to take only as few steps as necessary.