Euller
Euller
of
Ordinary Differential Equations
1
Chapter Objectives
Understanding the meaning of local and global truncation
errors and their relationship to step size for one-step
methods for solving ODEs.
Knowing how to implement the following Runge-Kutta (RK)
methods for a single ODE:
Euler
Heun
Midpoint
Fourth-Order RK
Knowing how to iterate the corrector of Heuns method.
Knowing how to implement the following Runge-Kutta
methods for systems of ODEs:
Euler
Fourth-order RK
Ordinary Differential Equations
Methods described here are for solving differential
equations of the form:
dy
f t, y
dt
The methods in this chapter are all one-step
methods and have the general format:
yi1 yi h
where is called an increment function, and is
used to extrapolate from an old value yi to a new
value yi+1.
Eulers Method
The first derivative
provides a direct
estimate of the slope
at ti: dy
f t i , yi
dt ti
and the Euler method
uses that estimate as
the increment
function:
f t i , yi
yi1 yi f t i , yi h
Leonhard Euler made a
huge number of
contributions to
mathematics, almost half
after he was totally blind.
f x (function notation)
(pi)
i 1
(summation)
dy
2x Initial Value: (0, 1)
dx
f ( x) dx f ( x dx) f ( x)
f ( x dx) f ( x) f ( x) dx
Which brings us to
Eulers Method
of
Approximations
f ( x dx) f ( x) f ( x) dx
So if we know f (x ), we have a value for dx ,
and we have an initial value f (a)
Then by Eulers Method:
dy
2x Initial Value: (0, 1)
dx
f (0.5) 1 2
So we have an
approximate coordinate 1
(0.5, 1)
How could we use this to
approximate f (1) ? 0 1 2 3
dy 5
2x y0 1 dx 0.5
dx
dy 4
n xn yn dx dy yn1
0 0 1 0 0 1
3
1 .5 1 1 .5 1.5
2 1 1.5 2 1 2.5 2
1
dy
dx dy yn dy yn1
dx
0 1 2 3
dy 5
2x y0 1 dx 0.5
dx
dy 4
n xn yn dx dy yn1
0 0 1 0 0 1
3
1 .5 1 1 .5 1.5
2 1 1.5 2 1 2.5 2
3 1.5 2.5 3 1.5 4.0
4 2.0 4.0 1
dy
dx dy yn dy yn1
dx
0 1 2 3
dy 5
2x 0,1 dx 0.5
dx
4
Exact Solution:
dy 2 x dx 3
y x2 C
2
1 0C
1
y x 1
2
0 1 2 3
5
This is called Eulers Method.
4
It is more accurate if a smaller
value is used for dx.
3
0 1 2 3
Error Analysis for Eulers Method
The numerical solution of ODEs involves two types
of error:
Truncation errors, caused by the nature of the techniques
employed
Roundoff errors, caused by the limited numbers of
significant digits that can be retained
The total, or global truncation error can be further
split into:
local truncation error that results from an application
method in question over a single step, and
propagated truncation error that results from the
approximations produced during previous steps.
Error Analysis for Eulers Method
The local truncation error for Eulers method
is O(h2) and proportional to the derivative of
f(t,y) while the global truncation error is O(h).
This means:
The global error can be reduced by decreasing
the step size, and
Eulers method will provide error-free predictions
if the underlying function is linear.
Eulers method is conditionally stable,
depending on the size of h.
Heuns method
To improve the estimate of the slope,
determine two derivatives for the interval:
At the initial point
At the end point
Predictor : yi01 yi f ( xi , yi )h
f ( xi , yi ) f ( xi 1 , yi01 )
Corrector : yi 1 yi h
2
18
The Midpoint (or Improved Polygon) Method
h
yi 1/2 yi f ( xi , yi )
2
yi 1 yi f ( xi 1/ 2 , yi 1/ 2 )h
19
Runge-Kutta Methods
Runge-Kutta (RK) methods achieve the accuracy of a Taylor
series approach without requiring the calculation of higher
derivatives.
For RK methods, the increment function can be generally
written as:
a1k1 a2 k2 an kn
where the as are constants and the ks are
k1 f t i , yi
k2 f t i p1h, yi q11k1h
k3 f t i p2 h, yi q21k1h q22 k2 h