5
Course: Numerical Solution of Ordinary Differential Equations Module 3 Systems of equations and higher order equations keywords: system of differential equations, Euler method, Runge-Kutta methods

lecture1_2

Embed Size (px)

Citation preview

Page 1: lecture1_2

Course: Numerical Solution of Ordinary Differential Equations

Module 3

Systems of equations and higher order equations

keywords: system of differential equations, Euler method, Runge-Kutta methods

Page 2: lecture1_2

Systems of Differential Equations

The mathematical models of many real life dynamical problems give rise to system of first order

differential equations. For example, dynamics of interacting species, chemical or biological, at

molecular, cellular or population level is modeled as a system of n first order differential

equations. The number n depends upon the species involved in the interaction. The study of

combustion dynamics can give a large system with n in hundreds or even in thousands. The

system of differential equations generally involved wide variety of possible behaviors as

compared to single differential equation. As such more advanced mathematics is required for

their analysis. However when it comes to numerical techniques for solving them, there is not

much difference between the system of differential equations and single differential equations.

The most general form of a system of m differential equations can be written as

i i 1 2 3 m i 0iy (t) f t,y ,y ,y ,...y t ;y (0) y ;0 a t b (3.1)

In (3.1) t is independent variable and m dependent variables are 1 2 3 my ,y ,y ,...y . Introducing

column vector Y as T1 2 3 m(y ,y ,y ,...y ) , F as T

1 2 3 m(f ,f , f ,...f ) and Y0 as T01 02 03 0m(y ,y ,y ,...y ) , the

system (3.1) in matrix form is written as

0Y (t) F(t,Y);Y(0) Y ;0 t b (3.2)

The form (3.2) is similar to the IVP (1.2) with scalars being replaced by vectors.

Let the interval (a,b) is divided into N subintervals of width h=(b-a)/N such that the grid

points are tj=a+jh and tj+1=tj+h. Let yi,j ; i=1,2,…m and j=1,2,…N denote the

approximation of ith dependent variable yi (tj) at t=tj=t0+jh.

The Eulers method for the system of equations be written as

i,j 1 i,j i j 1,j 2,j m,jy y hf (t ,y ,y ,...,y );i 1,2,...,m and j 0,1,2,...,N (3.3)

Fourth Order Runge Kutta method for system of equations

1,i i j 1,j 2,j 3,j m,j

2,i i j 1,j 1,1 2,j 1,2 3,j 1,3 m,j 1,m

3,i i j 1,j 2,1 2,j 2,2 3,j 2,3 m,j 2,m

4,i i j 1

K f t ,y ,y ,y ,...,y , ;i 1,2,...,m

h h h h hK f t ,y K ,y K ,y K ,...,y K

2 2 2 2 2

h h h h hK f t ,y K ,y K ,y K ,...,y K

2 2 2 2 2

K f t h,y

,j 3,1 2,j 3,2 3,j 3,3 m,j 3,m

1,i 2,i 3,i 4,i

hK ,y hK ,y hK ,...,y hK

hyi, j 1 yi, j K 2K 2K K

6

    (3.4)

Page 3: lecture1_2

Example 3.1 Solve the system of differential equations with given initial conditions

using Eulers method in the interval (0,1) taking h=0.02

x =x+2y x(0)=6

y =3x+2y y(0)=4

Solution: The Euler method given in (3.3) is used for solving given system of two

equations (m=2):

1

2

f (x,y)=x+2y x(0)=6

f (x,y)=3x+2y y(0)=4

The computations are shown in the table 3.1.

j h t xj yj f1 f2

0 0.02 0 6 4 14 26

1 0.02 0.02 6.28 4.52 15.32 27.88

2 0.02 0.04 6.5864 5.0776 16.7416 29.9144

3 0.02 0.06 6.921232 5.675888 18.273008 32.115472

4 0.02 0.08 7.28669216 6.31819744 19.923087 34.49647136

5 0.02 0.1 7.685153901 7.00812687 21.7014076 37.07171544

6 0.02 0.12 8.119182054 7.74956118 23.6183044 39.85666851

7 0.02 0.14 8.591548142 8.54669455 25.6849372 42.86803352

8 0.02 0.16 9.105246886 9.40405522 27.9133573 46.12385109

9 0.02 0.18 9.663514033 10.3265322 30.3165785 49.64360657

10 0.02 0.2 10.2698456 11.3194044 32.9086543 53.44834555

11 0.02 0.22 10.92801869 12.3883713 35.7047613 57.56079863

Table 3.1 Solution of Example 3.1

Refer to euler-system of equations.xlsx 

 

 

 

 

 

 

Page 4: lecture1_2

Example 3.2 Solve the following system of differential equations with given initial

conditions using fourth order Runge Kutta method in the interval (0, 2) taking h=0. 5

x =x-xy x(0)=4

y =-y+xy y(0)=1

Solution: Consider the system with h=0.5, m=2

1

2

f (x,y)=x-xy x(0)=4

f (x,y)=-y+xy y(0)=1

The Runge-Kutta formulae given in (3.4) are used to compute solution. The

computations are shown in the table 3.2 [Ref. system_of_equations.xls]

t x y k11=f1(x,y) k12=f2(x,y) 0 4 1 0 3

t+h/2 x+h*k11/2 y+h*k12/2 k21=f1(x,y) k22=f2(x,y)

0.25 4 1.75 -3 5.25

t+h/2 x+h*k21/2 y+h*k22/2 k31=f1(x,y) k32=f2(x,y)

0.25 3.25 2.3125 -4.265625 5.203125

t+h x+h*k31 y+h*k32 k41=f1(x,y) k42=f2(x,y)

0.5 1.8671875 3.6015625 -4.85760498 3.12322998

phi1 phi2

-1.61573792 2.25245667

t1 x+phi1 y+phi2

0.5 2.384262085 3.252456665

 

t1 x y k11=f1(x,y) k12=f2(x,y)

0.5 2.384262085 3.252456665 -5.37044702 4.50225244

t1+h/2 x+h*k11/2 y+h*k12/2 k21=f1(x,y) k22=f2(x,y)

0.75 1.041650329 4.378019776 -3.51871541 0.18234596

t1+h/2 x+h*k21/2 y+h*k22/2 k31=f1(x,y) k32=f2(x,y)

0.75 1.504583232 3.298043156 -3.4575972 1.66413728

t1+h x+h*k31 y+h*k32 k41=f1(x,y) k42=f2(x,y)

1 0.655463485 4.084525303 -2.02179371 -1.40726811

phi1 phi2

-1.77873883 0.56566257

t2 x+phi1 y+phi2

1 0.605523256 3.818119233  

 

Page 5: lecture1_2

 

 

t2 x y k11=f1(x,y) k12=f2(x,y)

1 0.605523256 3.818119233 -1.70643673 -1.50615924

t2+h/2 x+h*k11/2 y+h*k12/2 k21=f1(x,y) k22=f2(x,y)

1.25 0.178914073 3.441579422 -0.43683292 -2.82583243

t2+h/2 x+h*k21/2 y+h*k22/2 k31=f1(x,y) k32=f2(x,y)

1.25 0.496315026 3.111661125 -1.04804915 -1.56729695

t2+h x+h*k31 y+h*k32 k41=f1(x,y) k42=f2(x,y)

1.5 0.081498682 3.034470757 -0.16580669 -2.78716539

phi1 phi2

-0.40350063 -1.08996528

t3 x+phi1 y+phi2

1.5 0.202022627 2.728153949

 

t3 x y k11=f1(x,y) k12=f2(x,y)

1.5 0.202022627 2.728153949 -0.3491262 -2.17700512

t3+h/2 x+h*k11/2 y+h*k12/2 k21=f1(x,y) k22=f2(x,y)

1.25 0.114741077 2.183902669 -0.13584227 -1.93331933

t3+h/2 x+h*k21/2 y+h*k22/2 k31=f1(x,y) k32=f2(x,y)

0.25 0.16806206 2.244824118 -0.20920771 -1.86755435

t3+h x+h*k31 y+h*k32 k41=f1(x,y) k42=f2(x,y)

2 0.097418774 1.794376773 -0.07738721 -1.61957079

2 phi1 x+phi1 phi2 y+phi2

-0.09305111 0.108971514 -0.94986027 1.778293677 Table 3.2: Solution of the system of equations in Example 3.2

 

Accordingly, the first part of the table gives x(0.5)=2.384262085, y(0.5)=

3.252456665.The solution at t=1.0,1.5 and 2.0 are computed in the subsequent parts of

the table