Welcome to our community

Be a part of something great, join today!

Euler’s Method y'+2y=2-e^(-4t) y(0)-1

karush

Well-known member
Jan 31, 2012
2,886
Use Euler’s Method with a step size of h=0.1h=0.1
to find approximate values of the solution at
tt = 0.1, 0.2, 0.3, 0.4, and 0.5.
Compare them to the exact values of the solution at these points.

Given IVP
$$y'+2y=2-{{\bf{e}}^{- 4t}}\quad yt(0)=1$$
ok from a previous post we found that the general solution was
$$y( t ) = 1 + \frac{1}{2}{{\bf{e}}^{ - 4t}} - \frac{1}{2}{{\bf{e}}^{ - 2t}}$$


Steward gives this for Euler's Method so not real sure how to follow this
Have to go to class, but will back on this when I get back.


 

MarkFL

Administrator
Staff member
Feb 24, 2012
13,775
First, express the ODE in the form:

\(\displaystyle y'=f(t,y)\)

And then iterate the recursion:

\(\displaystyle y_{n+1}=y_n+hf\left(t_n,y_n\right)\)

where:

\(\displaystyle t_{n+1}=t_n+h\)

\(\displaystyle h=0.1,\,t_0=0,\,y_0=1\)
 

Country Boy

Well-known member
MHB Math Helper
Jan 30, 2018
731
Euler's method approximates the derivative, [tex]y'= \frac{dy}{dx}[/tex], by the "difference quotient [tex]\frac{\Delta y}{\Delta x}[/tex]: here [tex]\frac{\Delta y}{\Delta x}= -2y- e^{-4t}[/tex] or [tex]\Delta y= (-2y- e^{-4t})\Delta x[/tex].

Start with t= 0, y= 1. Taking [tex]\Delta t= 0.1[/tex], [tex]\Delta y= (-2- e^0)(0.1)= -0.3[/tex] so the next step is t= 0+ 0.1= 0.1, y= 1- 0.3= 0.7. Now, [tex]\Delta t[/tex] is still 0.1 and [tex]\Delta y= (-2(0.7)- e^{-0.4})(0.1)= (-1.4- 0.67032)(0.1)= -0.20703[/tex]. The third step is [tex]t= 0.1+ 0.1= 0.2[/tex] and [tex]y= 0.7- 0.20703= 0.492968[/tex]. [tex]\Delta t= 0.1[/tex] and [tex]\Delta y= (-2(0.492968)- e^{-0.8})(0.1)= -0.14353[/tex]. The fourth step is [tex]t= 0.2+ 0.1= 0.3[/tex] and [tex]y= 0.492968- 0.14353= 0.0492968[/tex]. Continue two more times.
 

karush

Well-known member
Jan 31, 2012
2,886
Euler's method approximates the derivative, [tex]y'= \frac{dy}{dx}[/tex], by the "difference quotient [tex]\frac{\Delta y}{\Delta x}[/tex]: here [tex]\frac{\Delta y}{\Delta x}= -2y- e^{-4t}[/tex] or [tex]\Delta y= (-2y- e^{-4t})\Delta x[/tex].
wait isn't
$$\displaystyle y'=\frac{\Delta y}{\Delta x}= (2-2y- e^{-4t})$$
$$\Delta y = (2-2y- e^{-4t}) \Delta x$$
 

karush

Well-known member
Jan 31, 2012
2,886
First, express the ODE in the form:

\(\displaystyle y'=f(t,y)\)

And then iterate the recursion:

\(\displaystyle y_{n+1}=y_n+hf\left(t_n,y_n\right)\)

where:

\(\displaystyle t_{n+1}=t_n+h\)

\(\displaystyle h=0.1,\,t_0=0,\,y_0=1\)
so $$f(t,y)=f(0,1)=2-2(0)-e^{-4(0)}=2-1=1$$
 

MarkFL

Administrator
Staff member
Feb 24, 2012
13,775
so $$f(t,y)=f(0,1)=2-2(0)-e^{-4(0)}=2-1=1$$
\(\displaystyle y'=f(t,y)=2-e^{-4t}-2y\)

And so:

\(\displaystyle y_{n+1}=y_n+h\left(2-e^{-4t_n}-2y_n\right)\)

We then begin with:

\(\displaystyle y(0)=y_0=1\) and \(\displaystyle t_0=0\)

\(\displaystyle y(0.1)\approx y_1=y_0+h\left(2-e^{-4t_0}-2y_0\right)=1+0.1\left(2-e^{-4\cdot0}-2\cdot1\right)=1+0.1(2-1-2)=0.9\)

For comparison:

\(\displaystyle y(0.1)=1+\frac{1}{2}e^{-0.4}-\frac{1}{2}e^{-0.2}\approx0.9257946\)

Now, continue iterating and comparing. :)