Originally Posted by

**Oiler** Hey all,

I have the IVP $\displaystyle \frac{dy}{dt} = y + t^2, y(0) = -1$

Using Euler's method with a step size h = 1, I want to compute the solution to the

IVP at final time t = 3.

I have done the following:

first step:

$\displaystyle y_0 = -1, t_0 = 0, h = 1$

$\displaystyle f(t_0,y_0) = -1 * 0^2 = -1$ I assume this should be -1 + 0^2

$\displaystyle y_1 = y_0 + h*f(t_0,y_0)$

$\displaystyle = -1 + 1 * -1 = -2$

second step:

$\displaystyle y_1 = -2, t_1 = 1, h = 1$

$\displaystyle f(t_1,y_1) = -2 * 1^2 = -1$ I assume this should be -2 + 1^2

$\displaystyle y_2 = y_1 + h*f(t_1,y_1)$

$\displaystyle = -2 + 1 * -1 = -3$

third step:

$\displaystyle y_2 = -3, t_2 = 2, h = 1$

$\displaystyle f(t_2,y_2) = -1 * 2^2 = 1$ I assume this should be -1 + 2^2 = 3

$\displaystyle y_3 = y_2 + h*f(t_2,y_2)$

$\displaystyle = -3 + 1 * 1 = -2$

I have solved the Linear DE and got $\displaystyle y = e^t-t^2-2t-2$

which when $\displaystyle t=3, y = e^{(3)}-(3)^2-2(3)-2 = 3.0855$. But Euler's method approximates the third step to be $\displaystyle -2$.

Have I done something wrong in my working ? or is it just that this model is not appropriate for this IVP. Thanks