# Euler's method

#### boks

Joined Oct 10, 2008
218
x'' - 2x' + x = 4t, x(0) = 1, x'(0)=1

Introducing $$y_1 = x$$ and $$y_2 = x'$$

we have the system

$$y_1 ' = y_2$$

$$y_2 ' = 2y_2 - y_1 + 4t$$

right?

Using Euler's method with step size h=0.1, we get

$$y_{1, n+1} = y_{1, n} + 0.1y_{2,n}$$

$$y_{2,n + 1} + 0.1(2y_{2,n} - y_{1,n} + 4t)$$

It's easy to see that $$y_{1, 1} = 1 + 0.1 \cdot 1 = 1.1$$, but what is $$y_{2,1}$$?

Last edited:

#### blazedaces

Joined Jul 24, 2008
130
$$y_{2,n} + 0.1(2y_{2,n} - y_{1,n} + 4t)$$

If $$y_{1,0}=1$$ and $$y_{2,0}=1$$, what is $$y_{2, 0.1}$$?

1.1 or 1.14?
What issues do you have with euler's method? What don't you understand? Why are you asking us to do simple problems for you?

-blazed

#### boks

Joined Oct 10, 2008
218
Updated first post.

Last edited:

#### blazedaces

Joined Jul 24, 2008
130
I don't see what the issue is here man...

Well, first of all, I'm going to see that by:

$$y_{2,n + 1} + 0.1(2y_{2,n} - y_{1,n} + 4t)$$
You actually meant:

$$y_{2,n + 1} = 0.1(2y_{2,n} - y_{1,n} + 4t)$$

In which case

$$y_{2,1} = 0.1(2y_{2,0} - y_{1,0} + 4t)$$

You have y_{2,0} and you have y_{1,0}.

Proceed. Good luck.

-blazed

Edit: Your t should be $$t_n$$ where $$t_{n+1} = t_n + h$$

#### steveb

Joined Jul 3, 2008
2,436
Actually, this is a good question and this issue can be a point of confusion when first learning. One often hears of Forward Euler and Backward Euler methods. The forward method is probably what you are using since it is more common and I think BlazedAces' answer is correct for that approach. However, in the backward Euler method the time value would be t(n+1) instead of t(n).

Anyway, I thought I'd mention that since what appears to be a simple problem can often have little points of confusion.

This simple Forward Euler method is generally not used for numerical analysis since the accuracy is much poorer than higher order methods. However, it is often used in real-time micorprocessor based control systems since the calculations can be perfomed quickly and with minimal delay.