next up previous
Next: Exercise 1.1: Newton's law Up: Ordinary differential equations: a Previous: Ordinary differential equations: a

Euler's method

Supouse that at a point $x_0$, the function $f$ has a value $y_0$. We want to find the approximate value of $y$ in a point $x_1$ close to $x_0$, $x_1=x_0+\Delta x$, with $\Delta x$ small. We assume that $f$, the rate of change of $y$, is constant in this interval $\Delta x$. Therefore we find:

    $\displaystyle dx \approx \Delta x =x_1-x_0,$ (2)
    $\displaystyle dy \approx \Delta y =y_1-y_0,$ (3)

with $y_1=y(x_1)=x(x_0+\Delta x)$. Then we approximate the value of $y_1$ as

\begin{displaymath}
y_1=y_0+f(x_0,y_0)(x_1-x_0)
\end{displaymath}

We can generalize this formula to find the value of $y$ at $x_2=x_1+\Delta x$ as

\begin{displaymath}
y_{2}=y_1+f(x_1,y_1)\Delta x,
\end{displaymath}

or in the general case:

\begin{displaymath}
y_{n+1}=y_n+f(x_n,y_n)\Delta x
\end{displaymath}

This is a good approximation as long as $\Delta x$ is ``small''. what is small? Depends on the problem, but it is basically defined by the ``rate of change'', or ``smoothness'' of $f$. $f(x)$ has to behave smoothly and without rapid variations in the interval $\Delta x$.

Notice that Euler's method is equivalent to a 1st order Taylor expansion about the point $x_0$. The ``local error'' calculating $x_1$ is then $O(\Delta x^2)$. If we use the method $N$ times to calculate $N$ consecutive points, the propagated ``global'' error will be $NO(\Delta x^2)\approx O(\Delta
x)$. This error decreases linearly with decreasing step, so we need to halve the step size to reduce the error in half. The numerical work for each step consists of a single evaluation of $f$.



Subsections
next up previous
Next: Exercise 1.1: Newton's law Up: Ordinary differential equations: a Previous: Ordinary differential equations: a
Adrian E. Feiguin 2004-06-01