Title: Lecture 20 Ordinary Differential Equations IVP
1Lecture 20 - Ordinary Differential Equations -
IVP
2Lectures Goals
ODE Methods
- Taylor Series Method
- Euler and Modified Euler Methods
- Runge-Kutta Method
- Multistep Method
- Adam Bashforth
- Adam Moulton Method
- Predictor-Corrector Method
- Stability
3Taylor Series Method
The Taylor series method is a straight forward
adaptation of classic calculus to develop the
solution as an infinite series. The catch is
that a computer usually can not be programmed to
construct the terms and one does not know how
many terms should be used. The method is not
strictly a numerical method but is use in
conjunction with numerical schemes.
4Taylor Series Method
Consider
The initial conditions is
The analytical solution
5Taylor Series Method
From the Taylor series expansion The step size
is defined as Using the initial condition, the
higher order derivatives of the equation can be
obtained.
6Taylor Series Method
The higher order derivatives can be found with
the initial condition, y(0) 1, and the
equation.
7Taylor Series Method
From the Taylor series expansion Plug in the
initial conditions Resulting in the equation
8Taylor Series Example
The results
9Taylor Series Example
Note that the last set of terms, you start to
lose accuracy for the 4th order All we know is
that it is in the range of 0lt x ltDh
10Taylor Series Method
Numerical analysis is an art. The number of
terms, we chose is a mater of judgment and
experience. We will normally truncate the Taylor
series, when the contribution of the last term is
negligible to the number of decimal places to
which we are working.
11Taylor Series Method
Taylor series applicable to higher order
equations, but one needs more initial
conditions The initial conditions are
12Taylor Series Method
We can use the initial conditions to get the
higher derivative, however it will become more
complicated. The higher order terms can be
calculated from previous values and they are
difficult to calculate.
13Euler Method
As you can see the Taylor series method is a bit
awkward to apply as the derivatives become more
complex. There are errors in finding the
derivatives. One thing about the Taylor series,
is that the error is small when the Dh is small
and only a few terms are need for good accuracy.
14Euler Method
The Euler method may be though of as extreme of
the idea for a Taylor series having a small error
when Dh is extremely small. The Euler method is
a first-order Taylor series with each step having
an upgrade of the derivative and y term changed.
15Euler Method
The Euler method can have the algorithm, where
the coefficients are upgraded each time step.
The first derivative and the initial y values
are update each iteration.
16Eulers methodFirst-order Taylor Method
Straight line approximation
y0
x0
x1
x2
x3
h
h
h
17Eulers Method Example
Consider The initial condition is The step
size is The analytical solution is
18Eulers Method Example
The algorithm has a loop using the initial
conditions and definition of the derivative The
derivative is calculated as The next y value is
calculated Take the next step
19Eulers Method Example
The results
20Eulers Method Example
Compare the error at y(0.1) with a Dh0.02 Error
1.1103-1.1081 0.0022 If we want the
error to be smaller than 0.0001 We need to
reduce the step size by 22 to get the desired
error.
21Eulers Method
- The trouble with this method is
- Lack of accuracy
- Small step size
Note for the simple Euler method, we use the
slope at the beginning of the interval , to
determine the increment to the function, but this
is always wrong. If the the slope is constant,
the solution is linear.
22Modified Euler Method
The Modified Euler method uses the slope at the
new location and is a predictor-corrector
technique. The method uses the average slope
between the two locations.
23Modified Euler Method
The algorithm will be Initial guess of the
value Updated value
24Modified Eulers Method Example
Consider The initial condition is The step
size is The analytical solution is
25Modified Eulers Method Example
The results are
26Modified Euler Method
If we were to look at the Taylor series expansion
Use a forward difference to represent the 2nd
derivative
27Runge-Kutta Methods
Runge-Kutta methods are very popular because of
their good efficiency and are used in most
computer programs for differential equations.
They are single-step methods, as the Euler
methods.
28Runge-Kutta Methods
To convey some idea of how the Runge-Kutta is
developed, lets look at the derivation of the
2nd order. Two estimates
29Runge-Kutta Methods
The initial conditions are The Taylor series
expansion
30Runge-Kutta Methods
Expand the derivatives The Taylor series
expansion becomes
31Runge-Kutta Methods
From the Runge-Kutta The definition of the
function Expand the next step
32Runge-Kutta Methods
From the Runge-Kutta Compare with the Taylor
series
4 unknowns
33Runge-Kutta Methods
The Taylor series coefficients (3 equations/4
unknowns) If you select a as If you select
a as Note These coefficient would result in a
modified Euler or Midpoint Method
34Runge-Kutta Method (2nd Order) Example
Consider Exact
Solution The initial condition is The step
size is Use the coefficients
35Runge-Kutta Method (2nd Order) Example
The values are
36Runge-Kutta Method (2nd Order) Example
The values are equivalent of Modified Euler
37Runge-Kutta Method (2nd Order) Example b
The values are
38Runge-Kutta Method (2nd Order) Example b
The values are
39Summary
- Taylor Series Expansion
- Euler Method
- Modified Euler Method
- Runge-Kutta Method
- 2nd order Method (Midpoint/Modified Euler)
40Homework
- Check the Homework webpage