You are on page 1of 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

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

yi (t) fi t,y1,y 2 ,y3 ,...ym t ;yi (0) y0i ;0 a t b

(3.1)

In (3.1) t is independent variable and m dependent variables are y1,y 2 ,y 3 ,...y m . Introducing
column vector Y as (y1, y 2 , y 3 ,...y m )T , F as (f1,f2 ,f3 ,...fm )T and Y0 as (y 01, y 02 , y 03 ,...y 0m )T , the
system (3.1) in matrix form is written as

Y(t) F(t,Y);Y(0) Y0 ;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
y i,j1 y i,j hfi (t j , y1,j , y 2,j ,..., y m,j );i 1,2,...,m and j 0,1,2,...,N

(3.3)

Fourth Order Runge Kutta method for system of equations

K1,i fi t j ,y1,j ,y 2,j ,y 3,j ,...,ym,j , ;i 1,2,...,m


h
h
h
h
h

K 2,i fi t j ,y1,j K1,1,y 2,j K1,2 ,y 3,j K1,3 ,...,ym,j K1,m


2
2
2
2
2

h
h
h
h
h

K 3,i fi t j ,y1,j K 2,1,y 2,j K 2,2 ,y 3,j K 2,3 ,...,ym,j K 2,m


2
2
2
2
2

K 4,i fi t j h,y1,j hK 3,1,y 2,j hK 3,2 ,y 3,j hK 3,3 ,...,ym,j hK 3,m


yi, j 1 yi, j

h
K1,i 2K 2,i 2K 3,i K 4,i
6

(3.4)

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
y=3x+2y

Solution:

x(0)=6
y(0)=4

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

equations (m=2):
f1(x,y)=x+2y

x(0)=6

f2 (x,y)=3x+2y

y(0)=4

The computations are shown in the table 3.1.


j

xj

yj

f1

f2

0.02

14

26

0.02

0.02

6.28

4.52

15.32

27.88

0.02

0.04

6.5864

5.0776

16.7416

29.9144

0.02

0.06

6.921232

5.675888

18.273008

32.115472

0.02

0.08

7.28669216

6.31819744

19.923087

34.49647136

0.02

0.1

7.685153901

7.00812687

21.7014076

37.07171544

0.02

0.12

8.119182054

7.74956118

23.6183044

39.85666851

0.02

0.14

8.591548142

8.54669455

25.6849372

42.86803352

0.02

0.16

9.105246886

9.40405522

27.9133573

46.12385109

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

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
y=-y+xy

x(0)=4
y(0)=1

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


f1(x,y)=x-xy

x(0)=4

f2 (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
0

x
4

y
1

k11=f1(x,y)
0

k12=f2(x,y)
3

t+h/2

x+h*k11/2

y+h*k12/2

k21=f1(x,y)

k22=f2(x,y)

0.25

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
0.5

t1+h/2

2.384262085
x+h*k11/2

0.75
t1+h/2

1.041650329
x+h*k21/2

0.75
t1+h

1.504583232
x+h*k31

0.655463485

k11=f1(x,y)
3.252456665

y+h*k12/2
4.378019776
y+h*k22/2
3.298043156
y+h*k32
4.084525303

-5.37044702
k21=f1(x,y)
-3.51871541
k31=f1(x,y)
-3.4575972
k41=f1(x,y)
-2.02179371
phi1
-1.77873883

t2

x+phi1
1

0.605523256

y+phi2
3.818119233

k12=f2(x,y)
4.50225244
k22=f2(x,y)
0.18234596
k32=f2(x,y)
1.66413728
k42=f2(x,y)
-1.40726811
phi2
0.56566257

t2

k11=f1(x,y)

k12=f2(x,y)

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

k11=f1(x,y)

k12=f2(x,y)

1.5

0.202022627

2.728153949

-0.3491262

-2.17700512

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)

0.097418774

1.794376773

-0.07738721

-1.61957079

phi1

x+phi1

phi2

y+phi2

-0.94986027

1.778293677

t3+h/2

-0.09305111

0.108971514

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

You might also like