# 2.7.2 y'=2y-1 Eulers Method

#### HallsofIvy

MHF Helper
I frankly don't understand what you are doing. One of us is very confused! The problem asks you to numerically solve several differential equations using "Euler's method" with different step lengths. But you start by analytically solving the equation, not using "Euler's method".

"Euler's method" is the very simplest method for numerically solving differential equations. It replaces the derivative, $$\displaystyle \frac{dy}{dt}$$ by the fraction $$\displaystyle \frac{\Delta y}{\Delta t}$$ where $$\displaystyle \Delta y$$ and $$\displaystyle \Delta t$$ are small changes in y and t respectively.

In the first problem you are given that $$\displaystyle y'= 3+ t- y$$ with initial value y(0)= 1. Using Euler's method, we approximate that by $$\displaystyle \frac{\Delta y}{\Delta t}= 3+ t- y$$ or $$\displaystyle \Delta y= (3+ t- y)\Delta t$$. In (a) we are asked to use a step length of h (my $$\displaystyle \Delta x$$) equal to 0.1 to find y(0.1), y(0.2), y(0.3), and y(0.4).
When t= 0, y= 1 so we have $$\displaystyle \Delta y= (3+ 0- 1)(0.1)= 2(0.1)= 0.2$$. When $$\displaystyle t= 0+ 0.1= 0.1$$, $$\displaystyle y= 1+ 0.2= 1.2$$.
Now when t= 0.1 we have $$\displaystyle \Delta y= (3+ 0.1- 1.2)(0.1)= 0.19$$. When $$\displaystyle t= 0.1+ 0.1= 0.2$$, $$\displaystyle y= 1.2+ 0.19= 1.39$$.
Now when t= 0.2 we have $$\displaystyle \Delta y= (3+ 0.2- 1.39)(0.1)= 0.181$$. When $$\displaystyle t= 0.2+ 0.1= 0.3$$, $$\displaystyle y= 1.39+ 0.181= 1.571$$.
Now when t= 0.3 we have $$\displaystyle \Delta y= (3+ 0.3- 1.571)(0.1)= 0.1729$$. When $$\displaystyle t= 0.3+ 0.1= 0.4$$, $$\displaystyle y= 1.571+ 0.1729= 1.7439$$.

That is what you should have for (a).

In (b) we are asked to take h to be 0.05 and compare to part (a).

Initially t= 0 and y= 1. $$\displaystyle \Delta y= (3+ 0- 1)(0.05)= 2(0.05)= 0.10$$ so the next step has t= 0+ 0.05= 0.05 and y= 1+ 0.10= 1.1.

Now $$\displaystyle \Delta y= (3+ 0.05- 1.10)(0.05)= 1.95(0.05)= 0.0975$$ so the next step has t= 0.05+ 0.05= 0.10 and y= 1.1+ 0.0975= 1.1975. Compare that to y= 1.2 above.
Now $$\displaystyle \Delta y= (3+ 0.10- 1.1975)(0.05)= 1.9025(0.05)= 0.095125$$ so the next step has t= 0.10+ 0.05= 0.15 and y= 1.1975+ 0.095125= 1.292625.
Now $$\displaystyle \Delta y= (3+ 0.15- 1.292625)(0.05)= 1.857375(0.05)= 0.09286875$$ so the next step has t= 0.15+ 0.05= 0.20 and y= 1.292625+ 0.09286875= 1.38549375. Compare that to 1.571 above.

Continue!

• 2 people

#### bigwave

I frankly don't understand what you are doing. One of us is very confused! The problem asks you to numerically solve several differential equations using "Euler's method" with different step lengths. But you start by analytically solving the equation, not using "Euler's method".

"Euler's method" is the very simplest method for numerically solving differential equations. It replaces the derivative, $$\displaystyle \frac{dy}{dt}$$ by the fraction $$\displaystyle \frac{\Delta y}{\Delta t}$$ where $$\displaystyle \Delta y$$ and $$\displaystyle \Delta t$$ are small changes in y and t respectively.

In the first problem you are given that $$\displaystyle y'= 3+ t- y$$ with initial value y(0)= 1. Using Euler's method, we approximate that by $$\displaystyle \frac{\Delta y}{\Delta t}= 3+ t- y$$ or $$\displaystyle \Delta y= (3+ t- y)\Delta t$$. In (a) we are asked to use a step length of h (my $$\displaystyle \Delta x$$) equal to 0.1 to find y(0.1), y(0.2), y(0.3), and y(0.4).
When t= 0, y= 1 so we have $$\displaystyle \Delta y= (3+ 0- 1)(0.1)= 2(0.1)= 0.2$$. When $$\displaystyle t= 0+ 0.1= 0.1$$, $$\displaystyle y= 1+ 0.2= 1.2$$.
Now when t= 0.1 we have $$\displaystyle \Delta y= (3+ 0.1- 1.2)(0.1)= 0.19$$. When $$\displaystyle t= 0.1+ 0.1= 0.2$$, $$\displaystyle y= 1.2+ 0.19= 1.39$$.
Now when t= 0.2 we have $$\displaystyle \Delta y= (3+ 0.2- 1.39)(0.1)= 0.181$$. When $$\displaystyle t= 0.2+ 0.1= 0.3$$, $$\displaystyle y= 1.39+ 0.181= 1.571$$.
Now when t= 0.3 we have $$\displaystyle \Delta y= (3+ 0.3- 1.571)(0.1)= 0.1729$$. When $$\displaystyle t= 0.3+ 0.1= 0.4$$, $$\displaystyle y= 1.571+ 0.1729= 1.7439$$.

That is what you should have for (a).

In (b) we are asked to take h to be 0.05 and compare to part (a).

Initially t= 0 and y= 1. $$\displaystyle \Delta y= (3+ 0- 1)(0.05)= 2(0.05)= 0.10$$ so the next step has t= 0+ 0.05= 0.05 and y= 1+ 0.10= 1.1.

Now $$\displaystyle \Delta y= (3+ 0.05- 1.10)(0.05)= 1.95(0.05)= 0.0975$$ so the next step has t= 0.05+ 0.05= 0.10 and y= 1.1+ 0.0975= 1.1975. Compare that to y= 1.2 above.
Now $$\displaystyle \Delta y= (3+ 0.10- 1.1975)(0.05)= 1.9025(0.05)= 0.095125$$ so the next step has t= 0.10+ 0.05= 0.15 and y= 1.1975+ 0.095125= 1.292625.
Now $$\displaystyle \Delta y= (3+ 0.15- 1.292625)(0.05)= 1.857375(0.05)= 0.09286875$$ so the next step has t= 0.15+ 0.05= 0.20 and y= 1.292625+ 0.09286875= 1.38549375. Compare that to 1.571 above.

Continue!
here is are book answers #1(b) Last edited:

#### topsquark

Forum Staff
Why is latex so small
You are posting an image in the text area, not posting it using MHF's LaTeX system. That's why it is small.

If you know LaTeX you can input the code here by wrapping it in [noparse] $$\displaystyle ...$$ [/noparse] tags.

-Dan

#### bigwave

ok why does the edit post disappear so soon.....

actually it is the text from replies that is so small not mine....
see the screenshot

#### topsquark

Forum Staff
ok why does the edit post disappear so soon.....

actually it is the text from replies that is so small not mine....
see the screenshot
If you need to make a change in a previous post just type it in and send it to me in a PM.

If I'm remembering correctly you have up to 24 hours to edit a post.

-Dan