$$ \newcommand{\D}{\displaystyle} \renewcommand{\eqref}[1]{Eq.~(\ref{#1})} $$

 

 

 

2.12 Basic notions on numerical methods for IVPs

In this section we define basic notions about numerical method that are needed in order to identify their essential properties.

Consider the first order ODE $$ \begin{align} y' = f(x,y), \tag{2.108} \end{align} $$

where \( f(x,y) \) is the source term. Moreover, the ODE is equipped with initial conditions $$ \begin{align} y(x_0) = y_0. \tag{2.109} \end{align} $$

Finally, we define \( y(x_n) \) as the solution of IVP defined by (2.108) and (2.109) evaluated at \( x=x_n \), whereas \( y_n \) is a numerical approximation of \( y(x_n) \) at the same location. We can now define an approximation error as $$ \begin{align} e_n = y(x_n) - y_n \tag{2.110} \end{align} $$

and some useful variants such as the absolute error $$ \begin{align} |e_n| = |y(x_n) - y_n| \tag{2.111} \end{align} $$

and the relative error $$ \begin{align} r_n =\frac{|y(x_n) - y_n|}{|y(x_n)|}. \tag{2.112} \end{align} $$

We can define a generic explicit numerical scheme for Equation (2.108) as $$ \begin{align} y_{n+1} = y_n + h \phi(x_n,y_n,h), \tag{2.113} \end{align} $$

where \( h \) is the discretization step for \( x \), i.e. \( h=x_{n+1}-x_n \), whereas \( \phi(x_n,y_n,h) \) is the increment function. Note that one can define a generic implicit or multi-step scheme by changing the arguments of \( \phi \).

Having defined a generic numerical scheme, we can say that it is consistent if $$ \begin{align} \lim_{h\to0} \phi(x,y,h) = \phi(x,y,0) = f(x,y). \nonumber \end{align} $$

In short, the approximation produced by a consistent numerical scheme will converge to the original ODE as \( h\to0 \).

Two additional useful definitions are the exact differential operator $$ \begin{align} L_e(y) = y' - f(x,y) = 0 \tag{2.114} \end{align} $$

and the approximate differential operator $$ \begin{align} L_a(y_n) = y_{n+1} - [y_n + h \phi(x_n,y_n,h)] = 0. \tag{2.115} \end{align} $$

Now we have introduced all necessary concepts to define the local truncation error (LTE) $$ \begin{align} \tau_n = \frac{1}{h} L_a(y(x_n)). \tag{2.116} \end{align} $$

In practice, one applies the approximate differential operator, that is defined by the numerical scheme, to the exact solution of the problem at hand. The evaluation of the exact solution for different \( x \) around \( x_n \), as required by \( L_a \) is performed using a Taylor series expansion.

Finally, we can state that a scheme is \( p \)-th order accurate by examining its LTE and observing its leading term $$ \begin{align} \tau_n = C h^p + H.O.T., \tag{2.117} \end{align} $$

where \( C \) is a constant, independent of \( h \) and \( H.O.T. \) are the higher order terms of the LTE.

Example: LTE for Euler's scheme

Consider the IVP defined by $$ \begin{equation} \tag{2.118} y' = \lambda y, \end{equation} $$

with initial condition $$ \begin{equation} \tag{2.119} y(0) = 1. \end{equation} $$

The approximation operator (2.115) for Euler's scheme is $$ \begin{align} L^{euler}_a = y_{n+1} - [y_n + h \lambda y_n], \tag{2.120} \end{align} $$

whereas the LTE can be computed by inserting \( y(x) \) in (2.120) $$ \begin{align} \tau_n = & \frac{1}{h}\left\{ L_a(y(x_n))\right\} = \frac{1}{h}\left\{ y(x_{n+1}) - [y(x_n) + h \lambda y(x_n)]\right\}, \tag{2.121}\\ = & \frac{1}{h}\left\{ y(x_n) + h y'(x_n) + \frac{h^2}{2} y''(x_n) + \ldots + \frac{1}{p!} h^p y^{(p)}(x_n) - y(x_n) - h \lambda y(x_n) \right\} \tag{2.122}\\ = & \frac{1}{2} h y''(x_n) + \ldots + \frac{1}{p!} h^{p-1} y^{(p)}(x_n) \tag{2.123}\\ \approx & \frac{1}{2} h y''(x_n). \tag{2.124} \end{align} $$