NM Ch6

You might also like

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

CHAPTER 6

Solving the Ordinary


Differential Equations

Faculty of Water Resources Engineering


PhD. Van Thao LE
CHAPTER 6

Numerical Methods

Faculty of Water Resources Engineering


PhD. Van Thao LE
SOLVING THE
ORDINARY
DIFFERENTIAL
EQUATIONS

Faculty of Water Resources Engineering


PhD. Van Thao LE
Faculty
Faculty
Faculty of ofofwater
Water
Faculty waterrecouces
recouces
Resources
of Project engineering
engineering
Engineering
Management LOGO
BMCSKTTL
TS. KHOA
PhD. VanLê VănLE
Thao ThảoM.S. Nguyen Van A

6.1 Introduction
6.2 Initial value problem (Cauchy problem)
We conside the simplest case of a single, first-order equation of the general type
dy / dx = f(x,y), with initial condition y(0) = A

y '  f ( x, y )
......................(*)
y ( x0 )  y0 
6.2.1 Method of successive approximation (Picard or iterative method)

Solving the equation (*) is to do a formal integration of this equation. This yields
x x x

 dy   f (t, y)dt
x0 x0
 y(x )  y(x 0 )   f ( t , y )dt
x0

or: y ( x)  y0   f (t , y (t ))dt.........(**)
x0 4
Faculty
Faculty
Faculty of ofofwater
Water
Faculty waterrecouces
recouces
Resources
of Project engineering
engineering
Engineering
Management LOGO
BMCSKTTL
TS. KHOA
PhD. VanLê VănLE
Thao ThảoM.S. Nguyen Van A

f
Asumption that f(x,y) is continue function and K
y

x
y1  y 0   f ( t , y 0 )dt
x0

x
Similarly: y 2  y 0   f ( t , y1 )dt
x0
Then we can systematically generalize this process by defining the following
successive approximation scheme:
x
y n  y 0   f ( t , y n1 )dt , n = 1,2,3,…
x0
x

So: y(x )  y n (x )  y 0   f ( t , y n1 )dt lim y n ( x )  y( x )


n  5
x0
Faculty
Faculty
Faculty of ofofwater
Water
Faculty waterrecouces
recouces
Resources
of Project engineering
engineering
Engineering
Management LOGO
BMCSKTTL
TS. KHOA
PhD. VanLê VănLE
Thao ThảoM.S. Nguyen Van A

M (KC) n
Estimated error: y n ( x )  y( x )  where : f ( x, y)  M
K .n!

and: x  x0 < a  , |y-y0|< b   , then C = min  a , b 


 M
6.2.2 Euler’s method
A simple but important method, y y=f(x)
which can be considered to be a A3
special case of the Taylor appro-
ximation, is known as the forward
A2
Euler method.
A1
Ao
First, dividing the interval [xo, X]
in n equal subinterval:
O xo x1 x2 x3 x
xi=xo+ih, i = 0,1,2,....,n
(X  x o )
where: h
n 6
Using the Taylor series expansion y=f(x) at x , we have:
Faculty
Faculty
Faculty of ofofwater
Water
Faculty waterrecouces
recouces
Resources
of Project engineering
engineering
Engineering
Management LOGO
BMCSKTTL
TS. KHOA
PhD. VanLê VănLE
Thao ThảoM.S. Nguyen Van A

y(ci )
y(x)  y(xi )  y(x i ).(x - x i )  ( x  xi ) 2
2!
where: ci = xi + (x - xi), 0 <  <1

and: x = xi+1 = xi + h, và y’(xi) = f(xi ,y(xi ))

y(ci )
There fore: y(x i 1 )  y(xi )  h.f(xi , y(x i ))  h . 2

2!
If the step size h is sufficiently small, the last term may be ignore

Estimated error

f
If: L and y ''  K where L, K are constant
y
Then:
ei  ui  y(x i )  M ( e0  h)
K
M e L ( x i x 0 )
,  7
2
Faculty
Faculty
Faculty of ofofwater
Water
Faculty waterrecouces
recouces
Resources
of Project engineering
engineering
Engineering
Management LOGO
BMCSKTTL
TS. KHOA
PhD. VanLê VănLE
Thao ThảoM.S. Nguyen Van A

6.2.3 Runge-Kutta methods

Fourth-order Runge-Kutta methods

1
ui +1 = ui + (k 1  2k 2  2k 3  k 4 )
6
where
k 1  h.f (x i , ui )
k  h.f (x  0.5h, u  0.5k )
 2 i i 1

k 3  h.f (x i  0.5h, ui  0.5k 2 )
k 4  h.f (x i  h, ui  k 3 )

Estimated error ui  Y (x i )  0(h 4 )


8
Faculty
Faculty
Faculty of ofofwater
Water
Faculty waterrecouces
recouces
Resources
of Project engineering
engineering
Engineering
Management LOGO
BMCSKTTL
TS. KHOA
PhD. VanLê VănLE
Thao ThảoM.S. Nguyen Van A

6.2.4 Adam methods


Solving ordinary differential equations (ODE) of the form

Y’ = f(x , y)

initial condition: Y(x0) = Y0

by any method (Exp: Runghe-Kutta methods), we find out continuously three roots
of this ODE :

Y1 = Y(x1) = Y(x 0+h), Y2 = Y(x0+2h), Y3 = Y(x0 + 3h)

Based on (x0,Y0), (x1,Y1), (x2,Y2), (x3,Y3), we can evaluate q0, q1, q2, q3.

Where: q0 = h.Y0’ = h.f(x0, y0), q1 = h.f(x1,y1), q2 = h.f(x2,y2), q3 = h.f(x3,y3).

After that, we establist a table of finite difference of y and q


9
Faculty
Faculty
Faculty of ofofwater
Water
Faculty waterrecouces
recouces
Resources
of Project engineering
engineering
Engineering
Management LOGO
BMCSKTTL
TS. KHOA
PhD. VanLê VănLE
Thao ThảoM.S. Nguyen Van A

x y y q q 2q 3q -------

xo yo qo

yo q0

x1 y1 q1  2 q0

y1 q1
 3 q0
x2 y2 q2  2 q1 -------
-
y2 q2 --------

x3 y3 q3 -------

------- ------- -------- ------- -------- -------- -------- -------


----- --- -- --- --- -- - 10
Faculty
Faculty
Faculty of ofofwater
Water
Faculty waterrecouces
recouces
Resources
of Project engineering
engineering
Engineering
Management LOGO
BMCSKTTL
TS. KHOA
PhD. VanLê VănLE
Thao ThảoM.S. Nguyen Van A

Knowings the term in the diagoanal, we can fint out y3 by Adam formulas:

1 5 2 3 3
y 3  q3  .q2  . q1  . .q0
2 12 8
Continuing, we calculate:

Y4 = Y3 + Y3  q4 = h.f(x4, Y4)

q3 = q4 – q3 , 2q2 = q3 - q2 , 3q1 = 2.q2 - 2.q1

With a new diagonal, we can continue to determine Y4 :

Y4 = q4 + 1/2.q3 + 5/12.2q2 + 3/8.3q1

Y5 = Y4 + Y4

and so on,… 11
Faculty
Faculty
Faculty of ofofwater
Water
Faculty waterrecouces
recouces
Resources
of Project engineering
engineering
Engineering
Management LOGO
BMCSKTTL
TS. KHOA
PhD. VanLê VănLE
Thao ThảoM.S. Nguyen Van A

PROBLEMS

1. Determine the roots of the following simultaneous linear eq. using the Gauss-
Seidel iteration method:

1,02x1 – 0,25x2 – 0,30x3 = 0,515


-0,41x1 +1,13x2 – 0,15x3 = 1,555
-0,25x1 – 0,14x2 + 1,21x3 = 2,780

12
Faculty
Faculty
Faculty of ofofwater
Water
Faculty waterrecouces
recouces
Resources
of Project engineering
engineering
Engineering
Management LOGO
BMCSKTTL
TS. KHOA
PhD. VanLê VănLE
Thao ThảoM.S. Nguyen Van A

END of CHAPTER 6

13

You might also like