Improved Euler’s Method
Improved Euler’s Method  Algorithm
Example
Improved Euler’s Method Error
Order of Error
Numerical Example
1
Numerical Example:
Consider the IVP
dy
dt
= 2
e

0
.
1
t

sin(
y
)
,
y
(0) = 3
,
which has no exact solution, so must solve numerically
Solve this problem with
Euler’s method
and
Improved
Euler’s method
Show differences with different stepsizes for
t
∈
[0
,
5]
Show the order of convergence by halving the stepsize twice
Graph the solution and compare to solution from
ode23
in
MatLab, closely approximating the exact solution
Joseph M. Mahaffy,
h
[email protected]
i
Lecture Notes – Numerical Methods for Differe
— (35/39)
Subscribe to view the full document.
Introduction
Euler’s Method
Improved Euler’s Method
Improved Euler’s Method  Algorithm
Example
Improved Euler’s Method Error
Order of Error
Numerical Example
2
Numerical Solution
for
dy
dt
= 2
e

0
.
1
t

sin(
y
)
,
y
(0) = 3
Used MatLab’s
ode45
to obtain an accurate numerical solution to
compare
Euler’s method
and
Improved Euler’s method
with
stepsizes
h
= 0
.
2,
h
= 0
.
1, and
h
= 0
.
05
“Actual”
Euler
Im Eul
Euler
Im Eul
Euler
Im Eul
t
n
h
= 0
.
2
h
= 0
.
2
h
= 0
.
1
h
= 0
.
1
h
= 0
.
05
h
= 0
.
05
0
3
3
3
3
3
3
3
1
5.5415
5.4455
5.5206
5.4981
5.5361
5.5209
5.5401
2
7.1032
7.1718
7.0881
7.1368
7.0995
7.1199
7.1023
3
7.753
7.836
7.743
7.7939
7.7505
7.7734
7.7524
4
8.1774
8.2818
8.167
8.2288
8.1748
8.2029
8.1768
5
8.5941
8.7558
8.5774
8.6737
8.5899
8.6336
8.5931
1
.
88%

0
.
194%
0
.
926%

0
.
0489%
0
.
460%

0
.
0116%
Last row shows percent error between the different approximations
and the accurate solution
Joseph M. Mahaffy,
h
[email protected]
i
Lecture Notes – Numerical Methods for Differe
— (36/39)
Introduction
Euler’s Method
Improved Euler’s Method
Improved Euler’s Method  Algorithm
Example
Improved Euler’s Method Error
Order of Error
Numerical Example
3
Error of Numerical Solutions
Observe that the
Improved Euler’s method
with stepsize
h
= 0
.
2 is more accurate at
t
= 5 than
Euler’s method
with
stepsize
h
= 0
.
05
With
Euler’s method
the error cuts in half with halving of the
stepsize
With the
Improved Euler’s method
the errors cuts in quarter
with halving of the stepsize
Joseph M. Mahaffy,
h
[email protected]
i
Lecture Notes – Numerical Methods for Differe
— (37/39)
Subscribe to view the full document.
Introduction
Euler’s Method
Improved Euler’s Method
Improved Euler’s Method  Algorithm
Example
Improved Euler’s Method Error
Order of Error
Numerical Example
4
Graph of Solution:
Actual, Euler’s and Improved Euler’s methods
with
h
= 0
.
2
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
1.8
2
0
5
10
15
20
25
30
t
y
(
t
)
dy/dt
=
y
+
t
Actual Solution
Euler Solution
Improved Euler
The Improved Euler’s solution is very close to the actual solution
Joseph M. Mahaffy,
h
[email protected]
i
Lecture Notes – Numerical Methods for Differe
— (38/39)
Introduction
Euler’s Method
Improved Euler’s Method
Improved Euler’s Method  Algorithm
Example
Improved Euler’s Method Error
Order of Error
Order of Error
Error of Numerical Solutions
Order of Error
without good “Actual solution”
Simulate system with stepsizes
h
,
h/
2, and
h/
4 and define
these simulates as
y
1
n
,
y
2
n
, and
y
3
n
, respectively
Compute the ratio (from Cauchy sequence)
R
=

y
3
n

y
2
n


y
2
n

y
1
n

If the numerical method is
order
m
, then this ratio is
approximately
1
2
m
Above example at
t
= 5 has
R
= 0
.
488 for
Euler’s method
and
R
= 0
.
256 for
Improved Euler’s method
Allows user to determine how much error numerical routine
is generating
Joseph M. Mahaffy,
h
[email protected]
i
Lecture Notes – Numerical Methods for Differe
— (39/39)
 Fall '08
 staff