# [SOLVED]2.7.2 Euler's method

#### karush

##### Well-known member
$\tiny{2.7.2}$
(a) Find approximate values of the solution of the given initial value problem\\
at $t = 0.1, 0.2, 0.3$, and $0.4$ using the Euler method with $h = 0.1$.

(b) Repeat part (a) with h = 0.05. Compare the results with those found in (a).

(c) Repeat part (a) with h = 0.025. Compare the results with those found in (a) and (b).

(d) Find the solution $y=\phi(t)$ of the given problem and evaluate
$\phi(t)$ at $t = 0.1,\quad 0.2, \quad 0.3,$ and $0.4$.

#1. $\quad\displaystyle y'=3+t-y \quad y(0)=1$

ok assume first step is to get a general solution
rewrite
$y'+y=3+t$
then
$ey'+ey=(ey)'=3+t$
so
$\displaystyle ey=\int{(3+t)} \, dt= \frac{t^2}{2} + 3 t + c$
isolate
$\displaystyle y=\frac{t^2}{2e} + 3 te^{-1} + c^{-e}$

$\color{red}{(a) 1.2, 1.39, 1.571, 1.7439}$
$\color{red}{(b) 1.1975, 1.38549, 1.56491, 1.73658}$
$\color{red}{(c) 1.19631, 1.38335, 1.56200, 1.73308}$
$\color{red}{(d) 1.19516, 1.38127, 1.55918, 1.72968}$

If I can get #1 probably 2,3 and 4 will be a slide
which are
2. $\quad y'=2y-1 \quad y(0)=1$
3. $\quad\displaystyle y'=y'=0.5-t+2y, \quad y(0)=1$
4. $\quad\displaystyle 3\cos{t} -2y \quad y(0)=0$

Last edited:

#### Klaas van Aarsen

##### MHB Seeker
Staff member
Euler's method is:
\begin{cases}
t_{k+1}&=t_k+h \\
y_{k+1}&=y_k+h\cdot y'(t_k; y_k)
\end{cases}
At $t_0=0$ we have $y_0=1$, so with $y'=3+t-y$ and $h=0.1$ we have at $t_1$:
\begin{cases}
t_1=t_0+h=0.1 \\
y_1=y_0 + 0.1\cdot y'(0;1)=1 + 0.1 (3+0-1)=1.2
\end{cases}

#### karush

##### Well-known member
ok Im still processing understanding this saw this on another example
not sure what n is

$$\displaystyle y_{n+1}=y_n +\textit{hf_n}$$ #### Klaas van Aarsen

##### MHB Seeker
Staff member
ok Im still processing understanding this saw this on another example
not sure what n is

$$\displaystyle y_{n+1}=y_n +\textit{hf_n}$$ Close enough.
The function $f$ describes $y'$. That is, we have:
$$y'(t) = f(t,y)$$
And $f_n$ is its value at $t_n, y_n$.

#### karush

##### Well-known member
Close enough.
The function $f$ describes $y'$. That is, we have:
$$y'(t) = f(t,y)$$
And $f_n$ is its value at $t_n, y_n$.
Ok I'll try the next one
See if i don't derail