On Solving Higher Order Equations for Ordinary

advertisement
Chapter 08.05
On Solving Higher Order Equations
for Ordinary Differential Equations
After reading this chapter, 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
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
(3.1)
y  z1
dy dz1
(3.2)

 z2
dx dx
d 2 y dz 2

 z3
(3.3)
dx
dx 2

d n 1 y dz n 1

 zn
(3.n)
dx
dx n 1
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
(4.1)
 z 2  f1 z1 , z 2 ,, x 
dx
dz 2
(4.2)
 z 3  f 2 z1 , z 2 ,, x 
dx

dz n
1
(4.n)
 an1 z n   a1 z 2  a0 z1  f x 

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
0  2 , find by Euler’s method
 2  y  et , y 0  1,
2
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
0.75
dt
Use a step size of h  0.25 .
Solution
c)
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
yi 1  yi  f1 t i , yi , z i h
(E2.3)
zi 1  zi  f 2 t i , 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
z1 is the approximate value of z (same as
dy
) at t  0.25
dt
08.05.4
z1  z0.25  1
For i  1, t1  0.25, y1  1.5, z1  1,
From Equation (E2.3)
y2  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
y2  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
z3 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
Chapter 08.05
Higher Order Equations
08.05.5
b) The exact value of y0.75 is
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%
dy
0.75  z3  0.12601
c)
dx
Example 3
Given
d2y
dy
dy
 2  y  e t ,y (0)  1, (0)  2 ,
2
dt
dt
dt
find by Heun’s method
a) y0.75
dy
0.75 .
b)
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 , yi , z i 
(E3.4a)

k 2y  f 1 t i  h, y i  hk 1y , z i  hk 1z
1 z
z i 1  z i 
k 1  k 2z h
2



(E 3.4b)
(E3.5)
08.05.6
Chapter 08.05
k 1z  f 2 t i , y i , z i 

k  f 2 t i  h, yi  hk , z i  hk
z
2
y
1
z
1

For i  0, to  0, yo  1, zo  2
From Equation (E3.4a)
k1y  f1 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
 f1 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
is
the
approximate
value of z at
z1
t  t1  0.25
(E3.6a)
(E3.6b)
Higher Order Equations
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.7
08.05.8
Chapter 08.05
For i  2, t2  0.50, y2  1.57384, z2  0.55533
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)
1
y 3  y 2  k1y  k 2y h
2
1
 1.5738  0.55533  0.0358360.25
2
 1.6477
y 3 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)
1
z 3  z 2  k1z  k 2z h
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
z 3  z 0.75  0.13158
The intermediate and the final results are shown in Table 1.


Higher Order Equations
08.05.9
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
k
2
1.1598
0.55533
k
4
 2.9158
 2.0779
k
1
0.43087
0.035836
k
yi 1
 2.7211
 1.9201
 1.3119
1.3750
1.5738
1.6477
zi 1
1.1598
0.55533
0.13158
y
1
z
1
y
2
z
2
ORDINARY DIFFERENTIAL EQUATIONS
Topic
Higher Order Equations
Summary
Textbook notes on higher order differential equations
Major
General Engineering
Authors
Autar Kaw
Last Revised February 6, 2016
Web Site
http://numericalmethods.eng.usf.edu
Download