next up previous contents
Next: How is the Approximation Up: The INITIAL VALUE PROBLEM Previous: Generalizations of Forward Euler   Contents

Errors in the Numerical Approximation of the IVP

The numerical solution of (10) is an approximation to the solution of (7), provided certain conditions are met and will be discussed presently. Why is the numerical solution called an approximation? Because invariably there are errors made. The types of errors incurred in the approximation are global and local ``truncation'' and ''round-off'' errors, along with errors related to to machine representation. In what follows we will group round-off and machine representation of numbers in one group and truncation errors in another group. The truncation errors are present regardless of exactness of machine representation of numbers or how the computation on the numerical scheme is carried out. Roundoff error and machine errors have to do with how the computation is carried out and on what type of machine. The Total Error is the accumulation of both types of error.

Local (and Global) Truncation = error made in one step when we replace an infinite process by a finite one (independent of round off error). (Global is sum over all steps). The Local Round off = error made by computing with limited precision on one step. (Global is cummulative round-off error). Total Error = sum of roundoff and truncation error. The sources of roundoff error are no different than those considered in the previous semester. The new ones, which we will devote our attention, is the truncation error. We'll mostly ignore rounding errors for now.

Example Suppose we use forward Euler to approximate the solution of

\begin{displaymath}
\left\{
\begin{array}{l} Y'=f(x,Y)\\
Y(a)=Y_0
\end{array}\right.
\end{displaymath}

and compare $y_h$ to true solution $Y(x)$ as follows: make a table (assume for simplicity that stepsize is constant and of size $h$). The table contains $y_h(x_n)$ for different values of $h$.

The table and its analysis constitute a ``convergence analysis.'' Most likely, we don't have $Y(x)$, the exact answer. Suppose we do.

        ``error'' $\equiv E_h(x)$
$h$         $x$         $y_n(x)$         $Y(x)$         $\vert y_n-Y_(x)\vert$
$0.20$ $0.40$ approx true $:$
  $0.80$ $:$ $:$ $:$
  $1.20$     $:$
  $1.60$     $:$
  $:$     $:$
$0.10$ $1.40$ approx true $:$
  $0.80$ $:$ $:$ $:$
  $1.20$     $:$
  $1.60$     $:$
  $:$     $:$
$0.05$ $1.40$ approx true $:$
  $0.80$ $:$ $:$ $:$
  $1.20$     $:$
  $1.60$     $:$
  $:$     $:$
  etc.      

What you see:

(1)
if numerical method is convergent $\Rightarrow$ as $h\rightarrow 0$     $y_h(x_n)$ will approach $Y(x_n)$ uniformly.

(2)
The last column shows the cummulative effect of errors, if any, in the integration, as a function of $x_n$ for a given $h$. We will call this the ``Global error'' $\equiv E_h(x_n)$

Take $E_{0.20}(x^{\star}), E_{0.10}(x^{\star}),
E_{0.05}(x^{\star})\cdots$ , corresponding to $h$ being halved, and the absolute difference $\vert y_h-Y\vert$ at some $x=x^{\star}$. For Euler, we'll see that the error will drop by $\displaystyle \frac12$ if we have. Since error drops proportional to $h$, we say the method's local truncation error is of order $h$.

Another way we can convey the global error is by making a plot of $E(h)$ as a function of $h$. The convention is to plot $E(h)$ on the vertical axis and $h$ on the horizontal axis, with $h$ DECREASING along the right. Furthermore, the plot should be a log-log plot. One picks a location $x^*$, sufficiently far from $x_0$ (this is determined largely on common sense). The discretization is picked so that for any $x^*$ is a value taken by $x_n$ for any given $h$. At this location the error $E(h)$ is recorded as a function of $h$ for the same initial data. The plot will show how this global error behaves as $h$ is changed. Moreover, as we will see later on, the slope of the log plot will indicate the ``convergence rate'' of the method, if the method converges. More on this later. $\Box$

Exercise. In some rare instances one can actually solve the resulting difference equation analytically. For example, we wish to solve

(11) $\displaystyle \left\{ \begin{array}{l} Y'=2x Y(0)=0. \end{array}\right.$

Verify that the exact solution is $Y(x)=x^2.$     Let $y_n\equiv y(x_n),\quad x_n=nh$      $n=0,1,
\cdots$

The forward Euler approximation to (11) is $y_{n+1}=y_n+
2h x_n $, with $y_0=0$.

Solution of difference equation: (see difference equations from previous semester, or use induction)

$y_n=x_{n}x_{n-1}\quad n\ge 1$


  % latex2html id marker 21005
$\displaystyle \therefore E_n\equiv \vert Y(x_n)-y_n\vert=\vert x^2_n-x_n x_{n-1}\vert=\vert hx_n\vert$    

% latex2html id marker 21007
$ \therefore$ Global error for each fixed value $x$ is proportional to $h$

$\Box$

There's more to the error analysis, of course. As always, the goal of scientific computing and numerical work is not to compute exactly, but to know exactly what errors are made. We need to learn a number of very useful theorems, which we can be used to tell whether we can have confidence in the answer obtained in a computation (remember as well that computers ALWAYS give answers), and can be extended to design numerical solutions to your practical problems. These theorems, together with detailed and careful work on the assignments will go a long way to teach you the basics of numerical analysis and scientific computing.


next up previous contents
Next: How is the Approximation Up: The INITIAL VALUE PROBLEM Previous: Generalizations of Forward Euler   Contents
Juan Restrepo 2003-05-02