MHB Estimate $y(0.5)$ using Euler's Method

ineedhelpnow
Messages
649
Reaction score
0
use euler's method with step size 0.1 to estimate y(0.5), where y(x) is the solution of the initial-value problem y'=y(x+1), y(0)=1. round your answer to four decimal places.

this is all I've done so far

$y'=y(x+1)$
$y(0)=1$
$h=0.1$
$x_{0}=0$
$y_{0}=1$

$x_{1}=x_{0}+h=0+0.1=0.1$
$x_{2}=x_{1}+h=0.1+0.1=0.2$
...etc. (im assuming that i stop once i reach $x_{n}=1$)

and then according to the book $y_{n}=y_{n-1}+hF(x_{n-1},y_{n-1})$ and n=1,2,3...

i think i understand how to do it but for my $F(x_{0},y_{0})$, $F(x_{1},y_{1})$,... do i plug the x and y into $y'=xy-x^2$ ?
 
Physics news on Phys.org
ineedhelpnow said:
use euler's method with step size 0.1 to estimate y(0.5), where y(x) is the solution of the initial-value problem y'=y(x+1), y(0)=1. round your answer to four decimal places.

this is all I've done so far

$y'=y(x+1)$
$y(0)=1$
$h=0.1$
$x_{0}=0$
$y_{0}=1$

$x_{1}=x_{0}+h=0+0.1=0.1$
$x_{2}=x_{1}+h=0.1+0.1=0.2$
...etc. (im assuming that i stop once i reach $x_{n}=1$)

and then according to the book $y_{n}=y_{n-1}+hF(x_{n-1},y_{n-1})$ and n=1,2,3...

i think i understand how to do it but for my $F(x_{0},y_{0})$, $F(x_{1},y_{1})$,... do i plug the x and y into $y'=xy-x^2$ ?

Your function $F(x,y)$ would be defined by $y' = F(x,y)$.
In other words:
$$F(x,y) = y \cdot (x+1)$$

That means that you have:
$$y_{n}
= y_{n-1}+h\cdot F(x_{n-1},y_{n-1})
= y_{n-1}+h\cdot y_{n-1}\cdot (x_{n-1} + 1)$$

Not sure where you got $y'=xy-x^2$. :confused:
 
oops my bad. i was looking at my problem and another example at the same time so i put the equation of the other example. the one from my problem is $y'=y(x+1)$
 
uuum...i spent 1 hour solving for $x_1$ to $x_{10}$ and $y_1$ to $y_{10}$ but the problem says to estimate y(0.5) so i think that means i was only supposed to go up to $x_5$ and $y_5$. is that right? did i seriously spend 45 minutes doing extra work that is totally unnecessary? (Speechless) (Angry)
 
ineedhelpnow said:
uuum...i spent 1 hour solving for $x_1$ to $x_{10}$ and $y_1$ to $y_{10}$ but the problem says to estimate y(0.5) so i think that means i was only supposed to go up to $x_5$ and $y_5$. is that right? did i seriously spend 45 minutes doing extra work that is totally unnecessary? (Speechless) (Angry)

Yep.
 
is $x_0=0$ and $y_0=1$?
 
ineedhelpnow said:
is $x_0=0$ and $y_0=1$?

Yes.
 
$x_{1}=0+0.1=0.1$

$x_{2}=0.1+0.1=0.2$

$x_{3}=0.2+0.1=0.3$

$x_{4}=0.3+0.1=0.4$

$x_{5}=0.4+0.1=0.5$$y_{1}=1+0.1F(0,1)=1+0.1(1)=1.1$

$y_{2}=1.1+0.1F(0.1,1.1)=1.1+0.1(1.21)=1.221$

$y_{3}=1.221+0.1F(0.2,1.221)=1.221+0.1(1.4652)=1.36752$

$y_{4}=1.36752+0.1F(0.3,1.36752)=1.36752+0.1(1.77778)=1.545298$

$y_{5}=1.545298+0.1F(0.4,1.545298)=1.545298+0.1(2.1634172)=1.76163972$

is that right? so is y(0.5)=1.7616?
 
ineedhelpnow said:
$x_{1}=0+0.1=0.1$

$x_{2}=0.1+0.1=0.2$

$x_{3}=0.2+0.1=0.3$

$x_{4}=0.3+0.1=0.4$

$x_{5}=0.4+0.1=0.5$$y_{1}=1+0.1F(0,1)=1+0.1(1)=1.1$

$y_{2}=1.1+0.1F(0.1,1.1)=1.1+0.1(1.21)=1.221$

$y_{3}=1.221+0.1F(0.2,1.221)=1.221+0.1(1.4652)=1.36752$

$y_{4}=1.36752+0.1F(0.3,1.36752)=1.36752+0.1(1.77778)=1.545298$

$y_{5}=1.545298+0.1F(0.4,1.545298)=1.545298+0.1(2.1634172)=1.76163972$

is that right? so is y(0.5)=1.7616?

Your method is correct.

The actual solution is:
$$y=e^{\frac 1 2 x(x+2)}$$
Meaning:
$$y(0.5)=e^{\frac 1 2 \cdot 0.5(0.5+2)} = e^{0.625} \approx 1.868$$

Your value seems a fair approximation.
 
  • #10
oh wow that's a big difference. so should i just say that according to euler's method $y(0.5)\approx 1.7616$
 
  • #11
ineedhelpnow said:
oh wow that's a big difference. so should i just say that according to euler's method $y(0.5)\approx 1.7616$

The expected error in each step is of order $h^2$.
Since we have 5 steps, we can expect an error of some constant times $5 \cdot 0.1^2 = 0.05$.
An error of about $0.1$ seems about right.

You'd get a better approximation with the method of Heun.
The generally preferred method is the one of Runge-Kutta, which will effectively be right on target, even with a fairly big step size.
 

Similar threads

Back
Top