Euler's method for numerical approximation

  • #1
165
0
y' = 3 + t - y, y(0) = 1

A) Find the approximate values of the solution of the given initial value problem at t = 0.1, 0.2, 0.3, 0.4 using the Euler method with h = 0.1.

B) Repeat part A with h = 0.05. Compare the results found in A.

I did part A correctly, but cannot get the right numbers for part B when I use the step size 0.05.

For part A, I did the following
(t0=0, y0=1)

Y1 = y0+f(t0,y0)*h = 1 + f(0,1)(0.1) = 1.2

Similarly,

Y2=y1+f(t1,y1)*h=1 + f(0.1,1.2)(0.1) = 1.39

Etc, etc.

However when I do part B, where h = 0.05, and try calculating Y1

Y1 = y0+f(t0,y0)*h = 1+f(0,1)(0.05) = 1.1

The answer in my book is 1.1975

What am I doing wrong?
 
  • #2
However when I do part B, where h = 0.05, and try calculating Y1

Y1 = y0+f(t0,y0)*h = 1+f(0,1)(0.05) = 1.1

The answer in my book is 1.1975

What am I doing wrong?
Everything seems to be correct in what you have posted so far. Remember, [tex]$ y_{n}=y_{n-1}+f(t_{n-1},y_{n-1})*h$[/tex] is an approximation of the value of y(t) at t=n*h.
 
  • #3
The general Euler forumla is:
[tex]
y_{i+1}=y_{i}+y'(y_{i},t_{i})h
[/tex]
so take h=0.05 to obtain:
[tex]
y_{0.05}=1+0.05*(3+0-1)=1.1
[/tex]
Now to calculate y at 0..1:
[tex]
y_{0.1}=1.1+0.05*(3+0.05-1.1)=1.1925
[/tex]
 
  • #4
Oh, thanks. I forgot to account for the step size change, meaning you take more steps to get to 0.1 now.
 
Last edited:

Suggested for: Euler's method for numerical approximation

Replies
0
Views
434
Replies
1
Views
643
Replies
1
Views
614
Replies
9
Views
825
Replies
9
Views
726
Replies
5
Views
805
Back
Top