# Euler's Method on differential equation

For a differential equation, it is known that Euler’s Method leads to an underestimate when the curve is concave up, just as it will lead to an overestimate when the curve is concave down:

(from page 326 in this document).

Here comes my question: Consider $\frac{dy}{dx}=2x-3(y-x^2)$ with $y(0)=0$. It is not difficult to verify that $y=x^2$ is the solution. Since the graph of $y=x^2$ is concave upward, then the approximation done by Euler's method should be an underestimation.

However, using Euler's method with step size 1, we have $y(1)=0$ and $y(2)=5>2^2$. Why?

• @Zev Chonoles: Thanks for the nice edit. – pipi Apr 8 '13 at 0:24

We have:

$$\tag 1 \frac{dy}{dx}=2x-3(y-x^2) ~~~~~ \text{with} ~~~~~ y(0)=0.$$

For the algorithm we have:

$t_0 = a = 0$

$w_0 = y(a) = y(0) = 0 \rightarrow \alpha = 0$

$h = 1$

$f(x, y) = 2x - 3 (y - x^2)$

Writing out the iteration formula, we have $w = w + h f(x, w)$, so

$\displaystyle w_i = w_{i-1} + (1) (2 x_{i-1} - 3 (w_{i-1} -x_{i-1}^2))$

Writing out the iterates, we have:

• $w_0 = 0$

• $w_1 = w_0 +2 x_0 -3(w_0 - x_0^2) = 0 + 0 -3(0 - 0) = 0$

• $w_2 = w_1 +2 x_1 -3(w_1 - x_1^2) = 0 + 2(1) - 3(0 - 1) = 2 - 3(-1) = 5$

If you look at the step size for this method, it plays havoc on the results.

A step size, $h=1$, is very large. Try a step size over the range $[0,2.5]$ of $h=0.1$ and see how that fares.

Also, it is useful to read the error bound calculations and the peculiar affects it can have with certain kinds of problems due to round-off.

There is a better algorithm with tighter controls on the mesh sizes to improve this, but this method is good for its instructiveness only and not very practical.

• Really nice work, today, Amzoti! +1 – amWhy Apr 8 '13 at 0:50
• @amWhy: I really appreciate the nice comments - so thanks for that. This poster did a great job and was spot on with his work - so I wanted to duplicate it and make sure I got the same thing. Regards – Amzoti Apr 8 '13 at 2:19