[Math] Derive forward Euler method for two-variable function

finite differencesnumerical methodsordinary differential equations

I need to derive the forward Euler method for solving ODEs and I would like some comments on what I have so far; overdot denote the time derivative: $\dot x \overset{def}{=} dx/dt$.

Say we have $\dot x = f(t, x)$ and want to approximate the solution $x(t)$.

The initial conditions are $x(t_0, x_0)$ and the approximate solution $x_1$ after one time $h$ step is sought, $x_1 \approx x(t_0 + h, x_0)$. $x$ is expanded as a Taylor series in $t$ around $(t_0, x_0)$:

$$
x(t_0 + h, x_0) = x(t_0, x_0) + \dot x(t_0, x_0)h + \frac{1}{2} \ddot x(t_0, x_0)h^2 + \dots\\
%
= x(t_0, x_0) + f(t_0, x_0)h + \mathcal{O}(h^2).
$$

Discarding anything of order $\mathcal{O}(h^2)$ or higher we are left with the Euler solution:

$$
x_1 = x(t_0, x_0) + f(t_0, x_0)h.
$$

It's pretty close to the derivation found on wikipedia; however, wikipedia does not include $x_0$ in the Taylor expansion.

Any comments – is the above correct?

EDIT: typo.

Best Answer

A different yet very simple and easy derivation of Euler's method is to consider the following $y'=f(x,y)$ (I hope you don't mind me using $x$ and $y$, the diagram for the graphical interpretation is in terms of $x$ and $y$, sorry.) with $y(x_0)=y_0$

If you imagine the graph of $y=y(x)$ (the solution) then $y'=f(x,y)$ is the slope of the tangent to the graph at the point $(x,y)$. The graph also passes through the point $(x_0,y_0)$ from the initial conditions, combining this graphically we get:

As an approximation to $y_1=y(x_1)$, we take $Y_1$ where $(x_1,Y_1)$ is a point on the tangent, using the equation for a straight line $y-y_0=m(x-x_0)$ and substituting the point $(x_1,Y_1)$ gives $$ Y_1=y_0+f(x_0,y_0)(x_1-x_0) $$ Using $h=(x_1-x_0)$ we arrive at the iteration scheme for Euler's method $$ Y_{n+1}=y_n+hf(x_n,y_n) $$ Sorry that this method went off on a bit of a tangent (pardon the pun) to the original problem but I just think it is a great way to derive Euler's method with minimal calculus needed.

Related Question