Professional Documents
Culture Documents
Mws Gen Ode Spe Higherorder PDF
Mws Gen Ode Spe Higherorder PDF
05
On Solving Higher Order Equations
for Ordinary Differential Equations
We have learned Euler’s and Runge-Kutta methods to solve first order ordinary differential
equations of the form
dy
= f ( x, y ), y (0) = y0 (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 dy
a n n + a n −1 n −1 + + a1 + ao y = f (x ) (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 dy
= − an −1 n −1 − a1 − a0 y + f ( x )
an dx dx
1
= (− a n−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
08.05.1
08.05.2 Chapter 08.05
dz1
= z 2 = f 1 ( z1 , z 2 , , x ) (4.1)
dx
dz 2
= z 3 = f 2 ( z1 , z 2 , , x ) (4.2)
dx
dz n 1
= (− a n−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 dy
3 2 + 2 + 5 y = e − x , y (0) = 5, y ′(0) = 7
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
dz 1 − x
= (e − 2 z − 5 y )
dx 3
The set of two simultaneous first order ordinary differential equations complete with the
initial conditions then is
dy
= z, y (0) = 5
dx
dz 1 − x
= (e − 2 z − 5 y ), z (0) = 7 .
dx 3
Now one can apply any of the numerical methods used for solving first order ordinary
differential equations.
Example 2
Given
d2y dy dy
2
+ 2 + y = e −t , y (0) = 1, (0) = 2 , find by Euler’s method
dt dt dt
a) y (0.75)
Higher Order Equations 08.05.3
b) the absolute relative true error for part(a), if y (0.75) exact = 1.668
dy
c) (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
dy
= z = f1 (t,y,z ), y (0) = 1 (E2.1)
dt
dz
= e −t − 2 z − y = f 2 (t , y , z ), z (0) = 2 (E2.2)
dt
Using Euler’s method on Equations (E2.1) and (E2.2), we get
y i +1 = y i + f1 (t i , y i , z i )h (E2.3)
z i +1 = z i + f 2 (t i , yi , z i )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 = y 0 + f 1 (t 0 , y 0 , 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 , y 0 , 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
08.05.4 Chapter 08.05
z1 = z (0.25) ≈ 1
For i = 1, t1 = 0.25, y1 = 1.5, z1 = 1 ,
From Equation (E2.3)
y 2 = y1 + f 1 (t1 , y1 , z1 )h
= 1.5 + f 1 (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)
y 3 = 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
y3 is the approximate value of y at
t = t 3 = t 2 + h = 0.5 + 0.25 = 0.75
y 3 = y (0.75) ≈ 1.8299
From Equation (E2.4)
z 3 = z 2 + f 2 (t 2 , y 2 , 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
z 3 = z (0.75) ≈ −0.12601
y (0.75) ≈ y3 = 1.8299
Higher Order Equations 08.05.5
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)
dy
b) (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
dy
= z = f1 (t,y,z ),y (0) = 1 (E3.1)
dt
dz
= e −t − 2 z − y = f 2 (t , y , z ), z (0) = 2 (E3.2)
dt
Using Heun’s method on Equations (1) and (2), we get
1
yi +1 = yi + (k1y + k 2y )h (E3.3)
2
k 1y = f 1 (t i , y i , z i ) (E3.4a)
(
k 2y = f 1 t i + h, y i + hk 1y , z i + hk 1z ) (E 3.4b)
1 z
z i +1 = z i +
2
( )
k 1 + k 2z h (E3.5)
08.05.6 Chapter 08.05
k 1z = f 2 (t i , y i , z i ) (E3.6a)
z
(
k = f 2 t i + h, y i + hk , z i + hk
2 1
y z
1 ) (E3.6b)
For i = 0, to = 0, yo = 1, zo = 2
From Equation (E3.4a)
k1y = f 1 (t o , y o , z o )
= f1 (0,1,2)
=2
From Equation (E3.6a)
k1z = f 2 (t 0 , y 0 , 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 ))
= f 1 (0.25,1.5,1)
=1
From Equation (E3.6b)
k 2z = f 2 (t 0 + h, y 0 + 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)
1
(
y1 = y 0 + k1y + k 2y h
2
)
1
= 1 + (2 + 1)(0.25)
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)
1
z1 = z 0 + (k1z + k 2z )h
2
1
= 2 + ( −4 + ( −2.7212))(0.25)
2
= 1.1598
z1 is the approximate value of z at
t = t1 = 0.25
Higher Order Equations 08.05.7
z1 = z (0.25) ≈ 1.1598
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)
1
y 2 = y1 + (k1y + k 2y )h
2
1
= 1.375 + (1.1598 + 0.43087 )(0.25)
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)
1
z 2 = z1 + (k1z + k 2z )h
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
08.05.8 Chapter 08.05