You are on page 1of 9

LECTURE NOTES

Solving Higher Order Equations for Ordinary Differential Equations

After reading this section, you should be able to:


1. solve higher order and coupled differential equations,

We have learned Euler’s and Runge-Kutta methods to solve first order ordinary differential
equations of the form
 f x, y , y 0  y0
dy
(1)
dx
What do we do to solve simultaneous (coupled) differential equations, or differential
equations that are higher than first order? For example an n th order differential equation of
the form
dny d n1 y
 ao y  f x 
dy
a n n  a n1 n1    a1 (2)
dx dx dx
with n  1 initial conditions can be solved by assuming
y  z1 (3.1)
dy dz1
  z2 (3.2)
dx dx
d 2 y dz 2
  z3 (3.3)
dx 2 dx

d n1 y dz n1
  zn (3.n)
dx n 1 dx
d n y dzn

dx n dx
1 d n 1 y 
   an 1 n 1   a1  a0 y  f x 
dy
an  dx dx 
=
1
 an1 z n   a1 z 2  a0 z1  f x  (3.n+1)
an
The above Equations from (3.1) to (3.n+1) represent n first order differential equations as
follows
dz1
 z 2  f1 z1 , z 2 ,, x  (4.1)
dx

1
Numerical methods and Computation II MATH375

dz 2
 z 3  f 2 z1 , z 2 ,, x  (4.2)
dx

dz n

1
 an1 z n   a1 z 2  a0 z1  f x  (4.n)
dx an
Each of the n first order ordinary differential equations are accompanied by one initial
condition. These first order ordinary differential equations are simultaneous in nature but can
be solved by the methods used for solving first order ordinary differential equations that we
have already learned.

Example 1
Rewrite the following differential equation as a set of first order differential equations.
d2y
3 2  2  5 y  e  x , y 0  5, y0  7
dy
dx dx
Solution
The ordinary differential equation would be rewritten as follows. Assume
dy
 z,
dx
Then
d 2 y dz

dx 2 dx
Substituting this in the given second order ordinary differential equation gives
dz
3  2z  5 y  e x
dx
 e  2 z  5 y 
dz 1  x
dx 3
The set of two simultaneous first order ordinary differential equations complete with the
initial conditions then is
 z, y 0  5
dy
dx
 e  2 z  5 y , z 0  7 .
dz 1  x
dx 3
Now one can apply any of the numerical methods used for solving first order ordinary
differential equations.

Example 2
Given
d2y
 2  y  e t , y 0  1, 0  2 , find by Euler’s method
dy dy
2
dt dt dt
a) y0.75
b) the absolute relative true error for part(a), if y0.75 exact  1.668

2
Solving higher order differential equations MATH375

c)
dy
0.75
dt
Use a step size of h  0.25 .
Solution
First, the second order differential equation is written as two simultaneous first-order
differential equations as follows. Assume
dy
z
dt
then
dz
 2 z  y  e t
dt
dz
 e t  2 z  y
dt
So the two simultaneous first order differential equations are
 z  f1 t,y,z , y (0)  1
dy
(E2.1)
dt
 et  2 z  y  f 2 t, y, z , z(0)  2
dz
(E2.2)
dt
Using Euler’s method on Equations (E2.1) and (E2.2), we get
yi 1  yi  f1 t i , yi , zi h (E2.3)
zi 1  zi  f 2 ti , yi , zi h (E2.4)
a) To find the value of y0.75 and since we are using a step size of 0.25 and starting at
t  0 , we need to take three steps to find the value of y0.75 .
For i  0, t0  0, y0  1, z0  2 ,
From Equation (E2.3)
y1  y0  f1 t 0 , y0 , z 0 h
 1  f1 0,1,20.25
 1  20.25
 1.5
y1 is the approximate value of y at
t  t1  t 0  h  0  0.25  0.25
y1  y0.25  1.5
From Equation (E2.4)
z1  z 0  f 2 t 0 , y0 , z 0 h
 2  f 2 0,1,20.25
 2  e 0  22  10.25
1
dy
z1 is the approximate value of z (same as ) at t  0.25
dt
z1  z0.25  1

3
Numerical methods and Computation II MATH375

For i  1, t1  0.25, y1  1.5, z1  1 ,


From Equation (E2.3)
y 2  y1  f1 t1 , y1 , z1 h
 1.5  f1 0.25,1.5,10.25
 1.5  10.25
 1.75
y 2 is the approximate value of y at
t  t 2  t1  h  0.25  0.25  0.50
y 2  y0.5  1.75
From Equation (E2.4)
z 2  z1  f 2 t1 , y1 , z1 h
 1  f 2 0.25,1.5,10.25
 1  e0.25  21  1.50.25
 1   2.72110.25
= 0.31970
z2 is the approximate value of z at
t  t 2  0.5
z2  z0.5  0.3197 0
For i  2, t2  0.5, y2  1.75, z2  0.31970 ,
From Equation (E2.3)
y3  y 2  f1 t 2 , y 2 , z 2 h
 1.75  f1 0.50,1.75,0.319700.25
 1.75  0.319700.25
 1.8299
y 3 is the approximate value of y at
t  t 3  t 2  h  0.5  0.25  0.75
y3  y0.75  1.8299
From Equation (E2.4)
z3  z 2  f 2 t 2 , y2 , z 2 h
 0.31972  f 2 0.50,1.75,0.319700.25
 0.31972  e0.50  20.31970  1.750.25
 0.31972   1.78290.25
 0.1260
z 3 is the approximate value of z at
t  t 3  0.75
z3  z0.75  0.12601
y 0.75  y3  1.8299
b) The exact value of y0.75 is

4
Solving higher order differential equations MATH375

y0.75 exact  1.668


The absolute relative true error in the result from part (a) is
1.668  1.8299
t  100
1.668
= 9.7062%
c)
dy
0.75  z3  0.12601
dx

Example 3
Given
d2y dy dy
2
 2  y  e t ,y (0)  1, (0)  2 ,
dt dt dt
find by Heun’s method
a) y0.75
b)
dy
0.75 .
dx
Use a step size of h  0.25 .
Solution
First, the second order differential equation is rewritten as two simultaneous first-order
differential equations as follows. Assume
dy
z
dt
then
dz
 2 z  y  e t
dt
dz
 e t  2 z  y
dt
So the two simultaneous first order differential equations are
 z  f1 t,y,z ,y (0)  1
dy
(E3.1)
dt
 et  2 z  y  f 2 t, y, z , z(0)  2
dz
(E3.2)
dt
Using Heun’s method on Equations (1) and (2), we get
yi 1  yi  k1y  k2y h
1
(E3.3)
2
k1y  f 1 t i , yi , z i  (E3.4a)

k 2y  f 1 t i  h, yi  hk1y , zi  hk1z  (E 3.4b)

z i 1  z i  1 z
2

k1  k 2z h (E3.5)

k1z  f 2 t i , yi , zi  (E3.6a)

5
Numerical methods and Computation II MATH375


k 2z  f 2 t i  h, yi  hk1y , zi  hk1z  (E3.6b)
For i  0, to  0, yo  1, zo  2
From Equation (E3.4a)
k1y  f1 t o , yo , z o 
 f1 0,1,2
2
From Equation (E3.6a)
k1z  f 2 t 0 , y0 , z 0 
 f 2 0,1,2
 e 0  22  1
= -4
From Equation (E3.4b)
k2y  f1 t0  h, y0  hk1y , z0  hk1z 
 f 1 0  0.25,1  0.252,2  0.25 4
 f1 0.25,1.5,1
=1
From Equation (E3.6b)
k 2z  f 2 t 0  h, y0  hk1y , z 0  hk1z 
 f 2 0  0.25,1  0.252,2  0.25 4
 f 2 0.25,1.5,1
 e 0.25  21  1.5
 2.7212
From Equation (E3.3)
y1  y0  k1y  k 2y h
1
2
 1  2  10.25
1
2
 1.375
y1 is the approximate value of y at
t  t1  t 0  h  0  0.25  0.25
y1  y0.25  1.375
From Equation (E3.5)
z1  z 0  k1z  k 2z h
1
2
1
 2  ( 4  ( 2.7212))(0.25)
2
 1.1598
z1 is the approximate value of z at
t  t1  0.25
z1  z0.25  1.1598

6
Solving higher order differential equations MATH375

For i  1, t1  0.25, y1  1.375, z1  1.1598


From Equation (E3.4a)
k1y  f1 t1 , y1 , z1 
 f1 0.25,1.375,1.1598
 1.1598
From Equation (E3.6a)
k1z  f 2 t1 , y1 , z1 
 f 2 0.25,1.375,1.1598
 e 0.25  21.1598  1.375
 2.9158
From Equation (E3.4b)
k2y  f1 t1  h, y1  hk1y , z1  hk1z 
 f1 0.25  0.25,1.375  0.25(1.1598),1.1598  0.25 2.9158
 f1 0.50,1.6649,0.43087
 0.43087
From Equation (E3.6b)
k 2z  f 2 t1  h, y1  hk1y , z1  hk1z 
 f 2 0.25  0.25,1.375  0.25(1.1598),1.1598  0.25 2.9158
 f 2 0.50,1.6649,0.43087
 e 0.50  20.43087  1.6649
 1.9201
From Equation (E3.3)
y 2  y1  k1y  k 2y h
1
2
 1.375  1.1598  0.43087 0.25
1
2
 1.5738
y 2 is the approximate value of y at
t  t 2  t1  h  0.25  0.25  0.50
y2  y 0.50  1.5738
From Equation (E3.5)
z 2  z1  k1z  k 2z h
1
2
1
 1.1598  (2.9158  (1.9201))(0.25)
2
 0.55533
z 2 is the approximate value of z at
t  t 2  0.50
z2  z0.50  0.55533
For i  2, t2  0.50, y2  1.57384, z2  0.55533

7
Numerical methods and Computation II MATH375

From Equation (E3.4a)


k1y  f1 t 2 , y 2 , z 2 
 f1 0.50,1.5738,0.55533
 0.55533
From Equation (E3.6a)
k1z  f 2 t 2 , y2 , z 2 
 f 2 0.50,1.5738,0.55533
 e 0.50  20.55533  1.5738
 2.0779
From Equation (E3.4b)
k2y  f 2 t2  h, y2  hk1y , z2  hk1z 
 f1 0.50  0.25,1.5738  0.25(0.55533),0.55533  0.25 2.0779
 f1 0.75,1.7126,0.035836
= 0.035836
From Equation (E3.6b)
k 2z  f 2 t 2  h, y2  hk1y , z 2  hk1z 
 f 2 0.50  0.25,1.5738  0.25(0.55533),0.55533  0.25 2.0779
 f 2 0.75,1.7126,0.035836
 e 0.75  20.035836  1.7126
 1.3119
From Equation (E3.3)
y3  y 2  k1y  k 2y h
1
2
 1.5738  0.55533  0.0358360.25
1
2
 1.6477
y3 is the approximate value of y at
t  t 3  t 2  h  0.50  0.25  0.75
y3  y 0.75  1.6477
b) From Equation (E3.5)
z 3  z 2  k1z  k 2z h
1
2
1
 0.55533  (2.0779  (1.3119))(0.25)
2
 0.13158
z 3 is the approximate value of z at
t  t 3  0.75
z3  z0.75  0.13158

The intermediate and the final results are shown in Table 1.

8
Solving higher order differential equations MATH375

Table 1 Intermediate results of Heun’s method.


i 0 1 2
ti 0 0.25 0.50
yi 1 1.3750 1.5738
zi 2 1.1598 0.55533
y
k 1 2 1.1598 0.55533
k 1
z
4  2.9158  2.0779
y
k 2 1 0.43087 0.035836
k 2
z
 2.7211  1.9201  1.3119
yi 1 1.3750 1.5738 1.6477
zi 1 1.1598 0.55533 0.13158

You might also like