Numerical Solution of ODE

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 55

CE 745

Ordinary Differential Equations


IVP (Initial Value Problems)

Material for your further study


KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 1
Material to be studied:
ODE Methods
• Modified Euler
• 2nd order Runge-Kutta Method
• 4th order Runge-Kutta Method
• Multi-step Method
– Adam Bashforth
– Adam Moulton Method
– Predictor-Corrector Method
• Stability

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 2


Modified Euler Method
The Modified Euler method uses the slope at the
new location and is a predictor-corrector technique.

⎛ yn′ + yn′ +1 ⎞
yn +1 = yn + Δh ⎜ ⎟ + O ( )
Δh 2

⎝ 2 ⎠

The method uses the average slope between the


two locations.

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 3


Modified Euler Method
The algorithm will be: yn′ = f ( xn , yn )
yn* +1 = yn + Δh yn′
Initial guess of the value yn′*+1 = f xn +1 , yn* +1 ( )
Updated value ⎛ yn′ + yn′*+1 ⎞
yn +1 = yn + Δh ⎜⎜ ⎟⎟
⎝ 2 ⎠

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 4


Modified Euler’s Method
Example
Consider
dy
= x+ y
dx
The initial condition is: y (0 ) = 1
The step size is: Δh = 0.02
The analytical solution is:
y ( x ) = 2e − x − 1
x

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 5


Modified Euler’s Method
Example
The results are:
Estimated Solution Average Exact Error
xn yn y'n hy'n y n+1 y'n+1 h(y'n+y'n+1 ) / 2 Solution
0 1.00000 1.00000 0.02000 1.02000 1.04000 0.02040 1.00000 0.00000
0.02 1.02040 1.04040 0.02081 1.04121 1.08121 0.02122 1.02040 0.00000
0.04 1.04162 1.08162 0.02163 1.06325 1.12325 0.02205 1.04162 -0.00001
0.06 1.06366 1.12366 0.02247 1.08614 1.16614 0.02290 1.06367 -0.00001
0.08 1.08656 1.16656 0.02333 1.10989 1.20989 0.02376 1.08657 -0.00001
0.1 1.11033 1.21033 0.02421 1.13453 1.25453 0.02465 1.11034 -0.00001
0.12 1.13498 1.25498 0.02510 1.16008 1.30008 0.02555 1.13499 -0.00002
0.14 1.16053 1.30053 0.02601 1.18654 1.34654 0.02647 1.16055 -0.00002
0.16 1.18700 1.34700 0.02694 1.21394 1.39394 0.02741 1.18702 -0.00002
0.18 1.21441 1.39441 0.02789 1.24229 1.44229 0.02837 1.21443 -0.00003
0.2 1.24277 1.44277 0.02886 1.27163 1.49163 0.02934 1.24281 -0.00003

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 6


Modified Euler Method
If we were to look at the Taylor series expansion
′ ′
1 2
yn +1 = yn + h yn + h yn′′ + O h 3
2
( )
Use a forward difference to represent the 2nd
derivative
1 2 ⎛ yn′ +1 − yn′
′ ′
yn +1 = yn + h yn + h ⎜
2 ⎝

( )
+ O(h )⎟ + O h 3
h ⎠
1 1
= yn + h yn′ + hyn′ +1 − hyn′ + O h 3
2 2
( )
⎛ yn′ +1 + yn′ ⎞
= yn + h⎜ ( )
⎟+O h
3

⎝ 2 ⎠
KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 7
Runge-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.

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 8


Runge-Kutta Methods
To convey some idea of how the Runge-Kutta is
developed, let’s look at the derivation of the 2nd order.
Two estimates

yn +1 = yn + ak1 + bk 2
k1 = Δhf ( xn , yn )
k 2 = Δhf (xn + αΔh, yn + βk1 )

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 9


Runge-Kutta Methods
The initial conditions are:
dy
= f ( x, y ) y (x0 ) = y0
dx
The Taylor series expansion
dy ( xn , yn ) Δh d y ( xn , yn )
2 2
y ( xn +1 ) = y ( xn ) + Δh + 2
dx 2! dx

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 10


Runge-Kutta Methods
Expand the derivatives:
d2y d
= [ f ( x, y )] = f x + f y
dy
2
= fx + fy f
dx dx dx
The Taylor series expansion becomes

yn +1 = yn + Δhf + Δh ⎢ ( f x + f y f )⎥
⎡1 2⎤
⎣2 ⎦

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 11


Runge-Kutta Methods
From the Runge-Kutta
yn +1 = yn + aΔhf + bΔhf ( xn + αΔh, yn + βΔhf )
The definition of the function
f ( xn + αΔh, yn + βΔhf ) = f + αΔhf x + βΔhf f y
Expand the next step
yn +1 = yn + aΔhf + bΔh ( f + αΔhf x + βΔhf f y )
= yn + [ a + b ] Δhf + bαΔh 2 f x + bβΔh 2 f f y

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 12


Runge-Kutta Methods
From the Runge-Kutta
yn +1 = yn + [ a + b ] Δhf + bαΔh 2 f x + bβΔh 2 f f y
Compare with the Taylor series
yn +1 = yn + Δhf + Δh ⎢ ( f x + f y f )⎥
⎡1 2 ⎤
⎣2 ⎦
[a + b] = 1
1
4 Unknowns αb =
2
1
βb =
2
KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 13
Runge-Kutta Methods
The Taylor series coefficients (3 equations/4 unknowns)
[a + b] = 1, αb = , βb =
1 1
2 2
If you select “a” as
2 1 3 3
a= , b= , α = , β =
3 3 2 2
If you select “a” as
1 1
a = b = , α = β =1
2 2
Note: These coefficient would result in a modified Euler or
Midpoint Method
KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 14
Runge-Kutta Method
(2nd Order) Example
Consider Exact Solution
dy 1
= −y 2 y=
dx 1+ x
The initial condition is: y (0 ) = 1
The step size is: Δh = 0.1

1 1
Use the coefficients a = b = , α = β =1
2 2
KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 15
Runge-Kutta Method
(2nd Order) Example
The values are

k1 = Δhf (xi , yi )
k 2 = Δhf ( xi + Δh, yi + k1 )

yi +1 = yi + [k1 + k 2 ]
1
2

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 16


Runge-Kutta Method
(2nd Order) Example
The values are equivalent of Modified Euler
k1 Estimate Solution k2 Exact Error
xn yn y'n hy'n y* n+1 y*' n+1 h(y*'n+1 )
0 1.00000 -1.00000 -0.10000 0.90000 -0.81000 -0.08100 1.000000 0.000000
0.1 0.90950 -0.82719 -0.08272 0.82678 -0.68357 -0.06836 0.909091 -0.000409
0.2 0.83396 -0.69549 -0.06955 0.76441 -0.58433 -0.05843 0.833333 -0.000629
0.3 0.76997 -0.59286 -0.05929 0.71069 -0.50507 -0.05051 0.769231 -0.000740
0.4 0.71507 -0.51133 -0.05113 0.66394 -0.44082 -0.04408 0.714286 -0.000789
0.5 0.66747 -0.44551 -0.04455 0.62292 -0.38802 -0.03880 0.666667 -0.000801
0.6 0.62579 -0.39161 -0.03916 0.58663 -0.34413 -0.03441 0.625000 -0.000790
0.7 0.58900 -0.34692 -0.03469 0.55431 -0.30726 -0.03073 0.588235 -0.000768
0.8 0.55629 -0.30946 -0.03095 0.52535 -0.27599 -0.02760 0.555556 -0.000738
0.9 0.52702 -0.27775 -0.02778 0.49925 -0.24925 -0.02492 0.526316 -0.000705
1 0.50067 -0.25067 -0.02507 0.47560 -0.22620 -0.02262 0.500000 -0.000671

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 17


Runge-Kutta Method
(2nd Order) Example [b]
2 1 3 3
The values are a= , b= , α = , β =
3 3 2 2

k1 = Δhf ( xi , yi )
k 2 = Δhf ( xi + αΔh, yi + βk1 )
yi +1 = yi + ak1 + bk 2

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 18


Runge-Kutta Method
(2nd Order) Example [b]
The values are
k1 Estimate Solution k2 Exact Error
xn yn y'n hy'n y* n+1 y*' n+1 h(y*'n+1 ) Exact
0 1.00000 -1.00000 -0.10000 0.85000 -0.72250 -0.07225 1.000000 0.000000
0.1 0.90925 -0.82674 -0.08267 0.78524 -0.61660 -0.06166 0.909091 -0.000159
0.2 0.83358 -0.69486 -0.06949 0.72935 -0.53195 -0.05320 0.833333 -0.000248
0.3 0.76953 -0.59217 -0.05922 0.68070 -0.46335 -0.04634 0.769231 -0.000295
0.4 0.71460 -0.51066 -0.05107 0.63800 -0.40705 -0.04070 0.714286 -0.000317
0.5 0.66699 -0.44488 -0.04449 0.60026 -0.36031 -0.03603 0.666667 -0.000324
0.6 0.62532 -0.39103 -0.03910 0.56667 -0.32111 -0.03211 0.625000 -0.000321
0.7 0.58855 -0.34639 -0.03464 0.53659 -0.28793 -0.02879 0.588235 -0.000314
0.8 0.55586 -0.30898 -0.03090 0.50951 -0.25960 -0.02596 0.555556 -0.000303
0.9 0.52661 -0.27731 -0.02773 0.48501 -0.23523 -0.02352 0.526316 -0.000291
1 0.50028 -0.25028 -0.02503 0.46274 -0.21412 -0.02141 0.500000 -0.000278

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 19


Runge-Kutta Methods
The Runge-Kutta methods are higher order
approximation of the basic forward integration.
These methods provide solutions which are
comparable in accuracy to Taylor series solution in
which higher order derivatives are retained.
It should be noted that the equations are not need to
be linear.

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 20


Method Equations

Euler Δy = k1
(Error of the order Δh2)
k1 = Δh[ f ( x, y )]
Modified Euler
(Error of the order Δh3) Δy =
1
[k1 + k 2 ]
2
k1 = Δh[ f ( x, y )]
k 2 = Δh[ f (x + Δh, y + k1 )]
Heun
Δy = [k1 + 3k 3 ]
1
(Error of the order Δh4)
4
k1 = Δh[ f (x, y )]
Runge-Kutta ⎡ ⎛ 1 1 ⎞⎤
k 2 = Δh ⎢ f ⎜ x + Δh, y + k1 ⎟ ⎥
Methods ⎣ ⎝
⎡ ⎛
3
2
3 ⎠⎦
2 ⎞⎤
k 3 = Δh ⎢ f ⎜ x + Δh, y + k 2 ⎟ ⎥
⎣ ⎝ 3 3 ⎠⎦
4th order Runge Kutta
(Error of the order Δh5) Δy =
1
[k1 + 2k 2 + 2k 3 + k 4 ]
6
k1 = Δh[ f ( x, y )]
⎡ ⎛ 1 1 ⎞⎤
k 2 = Δh ⎢ f ⎜ x + Δh , y + k 1 ⎟ ⎥
⎣ ⎝ 2 2 ⎠⎦
⎡ ⎛ 1 1 ⎞⎤
k 3 = Δh ⎢ f ⎜ x + Δ h , y + k 2 ⎟ ⎥
⎣ ⎝ 2 2 ⎠⎦
k 4 = Δh[ f ( x + Δh, y + k 3 )]

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 21


The 4th Order Runge-Kutta
This is a fourth order function that solves an initial
value problems using a four step program to get an
estimate of the Taylor series through the fourth
order.

This will result in a local error of O(Δh5) and a


global error of O(Δh4)

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 22


The 4 th Order Runge-Kutta
Δy = [k1 + 2k 2 + 2k3 + k 4 ]
The general form 1
of the equations: 6
k1 = Δh[ f ( x, y )]
⎡ ⎛ 1 1 ⎞⎤
k 2 = Δh ⎢ f ⎜ x + Δh, y + k1 ⎟⎥
⎣ ⎝ 2 2 ⎠⎦
⎡ ⎛ 1 1 ⎞⎤
k3 = Δh ⎢ f ⎜ x + Δh, y + k 2 ⎟⎥
⎣ ⎝ 2 2 ⎠⎦
k 4 = Δh[ f ( x + Δh, y + k3 )]

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 23


4th-order
Runge-Kutta Method
f2
f4

f3

f1 f
f = ( f1 + 2 f 2 + 2 f 3 + f 4 )
1
6

xi xi + h/2 xi + h
KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 24
Runge-Kutta Method
(4th Order) Example

Consider Exact Solution


dy
= y−x 2 y = 2 + 2x + x − e2 x

dx
The initial condition is: y (0 ) = 1
The step size is:
Δh = 0.1

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 25


The 4 th Order Runge-Kutta
The example of a single step:

(
k1 = Δh[ f ( x, y )] = 0.1 f (0,1) = 0.1 1 − 0 2 = 0.1 )
⎡ ⎛ 1 ⎞⎤
k 2 = Δh ⎢ f ⎜ x + Δh, y + k1 ⎟⎥ = 0.1 f (0.05,1.05) = 0.10475
1
⎣ ⎝ 2 2 ⎠⎦
⎡ ⎛ 1 ⎞⎤
k3 = Δh ⎢ f ⎜ x + Δh, y + k 2 ⎟⎥ = 0.1 f (0.05,1. + k 2 / 2 ) = 0.104988
1
⎣ ⎝ 2 2 ⎠⎦
k 4 = Δh[ f ( x + Δh, y + k3 )] = 0.1 f (0.1,1.104988) = 0.109499

yn +1 = yn + [k1 + 2k 2 + 2k3 + k 4 ] = 1.104829


1
6

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 26


Runge-Kutta Method
(4th Order) Example
The values for the 4th order Runge-Kutta method
x y f(x,y) k 1 f2 k 2 f3 k 3 f4 k 4 Change Exact
0 1 1 0.1 1.0475 0.10475 1.049875 0.104988 1.094988 0.109499 0.628974 1
0.1 1.104829 1.094829 0.109483 1.13707 0.113707 1.139182 0.113918 1.178747 0.117875 0.682608 1.104829
0.2 1.218597 1.178597 0.11786 1.215027 0.121503 1.216848 0.121685 1.250282 0.125028 0.729263 1.218597
0.3 1.340141 1.250141 0.125014 1.280148 0.128015 1.281648 0.128165 1.308306 0.130831 0.768204 1.340141
0.4 1.468175 1.308175 0.130817 1.331084 0.133108 1.332229 0.133223 1.351398 0.13514 0.79862 1.468175
0.5 1.601278 1.351278 0.135128 1.366342 0.136634 1.367095 0.13671 1.377988 0.137799 0.819614 1.601279
0.6 1.73788 1.37788 0.137788 1.384274 0.138427 1.384594 0.138459 1.38634 0.138634 0.830196 1.737881
0.7 1.876246 1.386246 0.138625 1.383059 0.138306 1.382899 0.13829 1.374536 0.137454 0.82927 1.876247
0.8 2.014458 1.374458 0.137446 1.360681 0.136068 1.359992 0.135999 1.340457 0.134046 0.815626 2.014459
0.9 2.150396 1.340396 0.13404 1.314915 0.131492 1.313641 0.131364 1.28176 0.128176 0.787927 2.150397
1 2.281717 1.281717 0.128172 1.243303 0.12433 1.241382 0.124138 1.195855 0.119586 0.744694 2.281718

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 27


Runge-Kutta Method
(4th Order) Example
4th Order Runge-Kutta Method

The values are equivalent 4

to those of the exact 2

solution. If we were to 0
0 1 2 3 4

go out to x=5. -2

Y Value
-4
y(5) = -111.4129 (-111.4132)
-6 Exact

The error is small relative -8


4th order

to the exact solution. -10


X Value

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 28


Runge-Kutta Method
(4th Order) Example
A comparison between the 2nd order and the 4th order
Runge-Kutta methods show a slight difference.

Runge Kutta Comparison Error of the Methods

4 10.00

2 Error 2nd order method


8.00
Error 4th order method

Absolute |Error|
0
0 1 2 3 4 6.00
Y Value

-2

-4 4.00

-6 Exact 2.00
2nd order
-8 0.00
4th order
-10 0 1 2 3 4 5

X Value X Value

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 29


The 4th Order Runge-Kutta
Higher order differential equations can be treated
as if they were a set of first-order equations.
Runge-Kutta type forward integration solutions can
be obtain. A more direct solution can be obtained
by repeating the whole process used in first-order
cases.

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 30


The 4 th Order Runge-Kutta
The general form of the 2nd order equations:
y′′ = f ( x, y, y′)
k1 = Δh 2 [ f ( x, y, y′)]
⎛ Δh 2 ⎞ ⎡ ⎛ 1 Δh 1 1 ⎞⎤
k 2 = ⎜⎜ ⎟⎟ ⎢ f ⎜ x + Δh, y + y′ + k1 , y′ + k1 ⎟⎥
⎝ 2 ⎠⎣ ⎝ 2 2 4 Δh ⎠⎦
⎛ Δh 2 ⎞ ⎡ ⎛ 1 Δh 1 1 ⎞⎤
k3 = ⎜⎜ ⎟
⎟ ⎢ f ⎜ x + Δh , y + ′
y + k2 , y + ′ k 2 ⎟⎥
⎝ 2 ⎠⎣ ⎝ 2 2 4 Δh ⎠ ⎦
⎛ Δh 2 ⎞ ⎡ ⎛ 2 ⎞⎤
k 4 = ⎜⎜ ⎟⎟ ⎢ f ⎜ x + Δh, y + Δhy′ + k3 , y′ + k3 ⎟ ⎥
⎝ 2 ⎠⎣ ⎝ Δh ⎠ ⎦

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 31


The 4 th Order Runge-Kutta
The step sizes are:

Δy = [k1 + k 2 + k3 ]
1
3
Δy′ =
1
[k1 + 2k2 + 2k3 + k4 ]
3Δh
The next step would be:
y ( x + Δh ) = y (x ) + Δh y′( x ) + Δy
y′( x + Δh ) = y′( x ) + Δy′

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 32


One Step Method
Up until this point we have dealt with:
• Euler Method
• Modified Euler/Midpoint
• Runge-Kutta Methods

These methods are called single step methods,


because they use only the information from the
previous step.
KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 33
One Step Method
The techniques are defined as:

• These methods allow us to vary the step


size.
• Use only one initial value.
• After each step is completed the past step is
“forgotten: We do not use this information.

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 34


Multi-Step Methods

The principle behind a multi-step method


is to use past values, y and/or dy/dx to
construct a polynomial that approximate
the derivative function.

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 35


Multi-Step Methods
The method comes from integrating the functions.

xi+1
= f (x )
dy
dx ⇒ yi +1 = yi + ∫ f (x )dx
dy = f ( x )dx xi

xi+1

∫ dy =y i +1 − yi = ∫ f (x )dx
xi
KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 36
Multi-Step Methods
The integral can be represented.
xi+1
Δh
∫ f ( x )dx = [3 f i − f i−1 ] Two Point
xi 2
Three Point Adam Bashforth

Δh
= [23 f i − 16 f i−1 + 5 f i−2 ]
12
KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 37
Multi-Step Methods
The integral can be represented.

xi+1

∫ f ( x )dx
Four Point Adam Bashforth
xi
Δh
= [55 f i − 59 f i−1 + 37 f i−2 − 9 f i−3 ]
24

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 38


Multi-Step Methods
These methods are known as explicit schemes because
the use of current and past values are used to obtain the
future step.

The method is initiated by using either a set of know


results or from the results of a Runge-Kutta to start the
initial value problem.

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 39


Adam Bashforth Method
(4th Point) Example

Consider Exact Solution


dy
= y−x 2 y = 2 + 2x + x − e2 x

dx
The initial condition is: y (0 ) = 1
The step size is:
Δh = 0.1

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 40


4 Point Adam Bashforth
From the 4th order Runge Kutta
f (0,1) = 1.0000
f (0.1,1.104829 ) = 1.094829
f (0.2,1.218597 ) = 1.178597
f (0.3,1.340141) = 1.250141
The 4 Point Adam Bashforth is:

Δy =
0.1
[55 f 0.3 − 59 f 0.2 + 37 f 0.1 − 9 f 0 ]
24
KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 41
4 Point Adam Bashforth
The results are:

0.1 ⎡55(1.250141) − 59(1.178597 )⎤


Δy =
24 ⎢⎣ + 37(1.094829 ) − 9(1) ⎥

= 0.128038
Upgrade the values
y (0.4 ) = 1.340141 + 0.128038 = 1.468179
f (0.4,1.468179 ) = 1.308179
KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 42
4 Point Adam Bashforth
Method - Example
The values for the Adam Bashforth
x Adam Bashforth f(x,y) sum 4th order Runge-Kutta Exact
0 1 1 1 1
0.1 1.104828958 1.094829 1.104828958 1.104829
0.2 1.218596991 1.178597 1.218596991 1.218597
0.3 1.34014081 1.250141 30.72919 1.34014081 1.340141
0.4 1.468179116 1.308179 31.94617 1.468174786 1.468175
0.5 1.601288165 1.351288 32.78612 1.601278076 1.601279
0.6 1.737896991 1.377897 33.20969 1.737880409 1.737881
0.7 1.876270711 1.386271 33.17302 1.876246365 1.876247
0.8 2.014491614 1.374492 32.62766 2.014458009 2.014459
0.9 2.150440205 1.34044 31.52015 2.150395695 2.150397
1 2.281774162 1.281774 29.79136 2.281716852 2.281718

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 43


4 Point Adam Bashforth
Method - Example
4 Point Adam Bashforth Example

The explicit Adam 4

Bashforth method gave 2

solution gives good 0


0 1 2 3 4
results without having to -2

Y Value
go through large number -4
Adam Bashforth
-6
of calculations. -8
4th order Runge-Kutta
Exact

-10
X Value

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 44


Multi-Step Methods
There are second set of multi-step methods, which are
known as implicit methods. The implicit methods use
the future steps to modify the future steps.

What is used to do iterative method, which will make


an initial guess and use it until stability is reached.

The method is initiated by using either a set of know


results or from the results of a Runge-Kutta to start the
initial value problem.
KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 45
Implicit Multi-Step Methods
The main method is Adam Moulton Method

Three Point Adam-Moulton Method

Δh
Δy = [5 f i+1 + 8 f i − f i−1 ]
12
Four Point Adam-Moulton Method

Δh
Δy = [9 f i+1 + 19 f i − 5 f i−1 + f i−2 ]
24
KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 46
Implicit Multi-Step Methods
The method uses what is known as a Predictor-Corrector
technique. It uses the explicit scheme to estimate the
initial guess and uses the value to guess the future y* and
dy/dx= f*(x,y*) values. Using these results, the Adam
Moulton method can be applied.

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 47


Implicit Multi-Step Methods
Adams third order Predictor-Corrector scheme.

Use the Adam Bashforth three point explicit scheme for


the initial guess.
Δh
y *i +1 = yi + [23 f i − 16 f i−1 + 5 f i−2 ]
12
Use the Adam Moulton three point implicit scheme to
take a second step.
yi +1 = yi +
Δh
12
[ ]
5 f i *+1 + 8 f i − f i −1
KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 48
Adam Moulton Method
(3th Point) Example

Consider Exact Solution


dy
= y−x 2 y = 2 + 2x + x − e2 x

dx
The initial condition is: y (0 ) = 1
The step size is:
Δh = 0.1

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 49


4 Point Adam Bashforth
From the 4th order Runge Kutta

f (0,1) = 1.0000
f (0.1,1.104829 ) = 1.094829
f (0.2,1.218597 ) = 1.178597

The 3 Point Adam Bashforth is:

Δy =
0.1
[23 f 0.2 − 16 f 0.1 + 5 f 0.0 ]
12
KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 50
3 Point Adam Moulton
Predictor-Corrector Method
The results of explicit scheme is:
Δy =
0.1
[23(1.178597 ) − 16(1.094829) + 5(1)]
12
= 0.121587
The functional values are:
y * (0.3) = 1.218597 + 0.121587 = 1.340184
f * (0.3,1.340184 ) = 1.250184

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 51


3 Point Adam Moulton
Predictor-Corrector Method
The results of implicit scheme is:
Δy =
0.1
[5(1.250184) + 8(1.178597 ) − 1(1.094829)]
12
= 0.121541
The functional values are:
y (0.3) = 1.218597 + 0.121541 = 1.340138
f (0.3,1.340184 ) = 1.250138

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 52


3 Point Adam Moulton
Predictor-Corrector Method

The values for the Adam Moulton


Adam Moulton Three Point Predictor-Corrector Scheme
x y f sum y* f* sum
0 1 1
0.1 1.104829 1.094829
0.2 1.218597 1.178597 0.121587 1.340184 1.250184 0.121541
0.3 1.340138 1.250138 0.128081 1.468219 1.308219 0.12803
0.4 1.468168 1.308168 0.133155 1.601323 1.351323 0.133098
0.5 1.601266 1.351266 0.136659 1.737925 1.377925 0.136597
0.6 1.737863 1.377863 0.138429 1.876291 1.386291 0.138359
0.7 1.876222 1.386222 0.13828 2.014502 1.374502 0.138204
0.8 2.014425 1.374425 0.136013 2.150438 1.340438 0.135928
0.9 2.150353 1.340353 0.131404 2.281757 1.281757 0.13131
1 2.281663 1.281663 0.124206 2.405869 1.195869 0.124102
KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 53
3 Point Adam Moulton Predictor-
Corrector Method

Adam Moulton 3 Point Implicit Scheme


The implicit Adam
Moulton method gave 4

2
solution gives good 0

results without using -2


0 1 2 3 4

Y Value
more than a three points. -4
4th order Runge-Kutta
Exact
-6
Adam Moulton

-8 Adam Bashforth

-10
X Value

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 54


Summary
• Modified Euler
• 2nd Order Runge-Kutta
• 4th Order Runge-Kutta Method
• Higher Order Runge-Kutta Methods
• Explicit Multi-Step Methods
• Implicit Multi-Step Methods
• Stability

KSU, CE 745, Related to Set 7, (Dr. Asad Esmaeily) 55

You might also like