Professional Documents
Culture Documents
DIFFERENTIAL EQUATIONS
dy y
1. Use Euler's method to obtain a numerical solution of the differential equation dx = 3 - x , with
the initial conditions that x = 1 when y = 2, for the range x = 1.0 to x = 1.5 with intervals of 0.1.
dy y
y' 3
dx x
2
3
If initially x0 = 1 and y0 = 2, (and h = 0.1), then (y')0 = 1 =1
Line 1 in the table below is completed with x = 1.0 and y = 2
y0 2.1
and x
(y')0 = 3 - 0 = 3 - 1.1 = 1.0909
y0 2.209091
and (y')0 = 3 - x 0 = 3 - 1.2 = 1.159091
802
dy y
3
A graph of the solution of dx x , with initial conditions x = 1 and y = 2 is shown below.
1 dy
2. Obtain a numerical solution of the differential equation x dx + 2y = 1, given the initial conditions
1 dy dy
Since x dx + 2y = 1 then dx = x(1 – 2y) or y´ = x(1 – 2y)
x y (y')0
0 1 0
0.2 1 - 0.2
0.4 0.96 - 0.368
0.6 0.8864 - 0.46368
0.8 0.793664 - 0.469824
1.0 0.699692
803
For line 4, where x0 = 0.6: y1 = y0 + h(y')0 = 0.96 + (0.2)(- 0.368) = 0.8864
1 dy
Hence a numerical solution to the differential equation x dx + 2y = 1 is given by the first two
columns in the above table.
dy y
3. (a) The differential equation dx + 1 = - x has the initial conditions that y = 1 at x = 2. Produce a
4 x
(b) If the solution of the differential equation by an analytical method is given by y = x - 2 ,
dy y dy y
1 y ' 1
(a) dx x i.e. dx x
1
1
If initially x0 = 2.0 and y0 = 1, (and h = 0.1), then (y')0 = 2.0 = -1.5
Line 1 in the table below is completed with x = 2.0 and y = 1
y0 0.85
and x
(y')0 = -1 - 0 = -1 - 2.1 = -1.40476
804
For line 3, where x0 = 2.2: y1 = y0 + h(y')0 = 0.85 + (0.1)(-1.40476) = 0.709524
y0 0.709524
and x
(y')0 = -1 - 0 = -1 - 2.2 = -1.322511
4 x
(b) If y = x 2 then when x = 2.2, y = 0.718182
From the Euler method, when x = 2.2, y = 0.709524
= 1.206%
dy 2y
4. Use Euler's method to obtain a numerical solution of the differential equation dx = x - x , given
x2
If the solution of the differential equation is given by y = 4 , determine the percentage error by
dy 2y
y' x
(a) dx x
2(1)
2.0
If initially x0 = 2.0 and y0 = 1, (and h = 0.2), then (y')0 = 2.0 = 1.0
Line 1 in the table below is completed with x = 2.0 and y = 1
805
2(1.2)
and (y')0 = 2.2 - 2.2 = 1.109091
2(1.4218182)
and (y')0 = 2.4 - 2.4 = 1.2151515
x2
(b) If y = 4 , then when x = 2.8, y = 1.96
From the Euler method, when x = 2.8, y = 1.928718
= 1.596%
806
EXERCISE 201 Page 552
dy y
1. Apply the Euler-Cauchy method to solve the differential equation dx = 3 - x for the range
dy y
y' 3
dx x
x 0 = 1, y 0 = 2 and h = 0.1
y0 2
3 3 1
(y ) 0 x0 1
x 1 = 1.1 and from equation (3), page 548, y P1 = y 0 + h(y ) 0 = 2 + 0.1(1) = 2.1
1 1 yP
3 1
y = y 0 + 2 h (y ) 0 + f(x 1 , y P1 )
C1 = y 0 + 2 h (y ) 0 + x1
1 2.1
3
= 2 + 2 (0.1) 1 + 1.1
= 2.10454546
y C1 2.10454546
3 3
(y ) 1 x1 1.1 = 1.08677686
Thus the first two lines of the Table below has been completed
x y y
1.0 2 1
1.1 2.10454546 1.08677686
1.2 2.216666672 1.152777773
1.3 2.33461539 1.204142008
1.4 2.457142859 1.244897958
1.5 2.5883333335
807
1 yP
3 1
y C 1 = y 0 + 2 h (y ) 0 + x1
1 2.213223146
3
= 2.10454546 + 2 (0.1) 1.08677686 + 1.2 = 2.216666672
y C1 2.216666672
3 3
(y ) 1 x1 1.2 = 1.152777773
2. Solving the differential equation in Problem 1 by the integrating factor method gives
3 1
y = 2 x + 2x . Determine the percentage error, correct to 3 significant figures, when x = 1.3 using
3 1
x
If y = 2 2x then when x = 1.3, y = 2.334615385
2.334615385 2.3250
100%
Percentage error = 2.334615385 = 0.412%
2.334615385 2.33461539
100%
Percentage error = 2.334615385 = 0.000000214%
dy
3. (a) Apply the Euler-Cauchy method to solve the differential equation dx - x = y for the range
x
(b) The solution of the differential equation in part (a) is given by y = 2e - x - 1. Determine the
dy
y'
(a) dx =y+x
808
x 0 = 0, y 0 = 1 and h = 0.1
(y ) 0 = 1 + 0 = 1
x 1 = 0.1 and from equation (3), page 548, y P1 = y 0 + h(y ) 0 = 1 + 0.1(1) = 1.1
1 1
y C 1 = y 0 + 2 h (y ) 0 + f(x 1 , y P1 ) = y 0 + 2 h (y ) 0 + y P1 + x 1
1
= 1 + 2 (0.1) 1 + 1.1 + 0.1
= 1.11
Thus the first two lines of the Table below has been completed
1
y = y 0 + 2 h (y ) 0 + y P1 + x 1
C1
1
= 1.11 + 2 (0.1) 1.21 + 1.231 + 0.2 = 1.24205
809
1.583649395 1.581804
100%
Hence, the percentage error = 1.583649395 = 0.117%
1 dy
4. Obtain a numerical solution of the differential equation x dx + 2y = 1 using the Euler-Cauchy
method in the range x = 0(0.2)1.0, given the initial conditions that x = 0 when y = 1
1 dy dy
Since x dx + 2y = 1 then dx = x(1 – 2y) or y´ = x(1 – 2y)
x y (y')0
0 1 0
0.2 0.98 - 0.192
0.4 0.925472 - 0.3403776
0.6 0.84854666 -
0.41825599
0.8 0.76433779 -
0.42294046
1.0 0.68609380
For line 2, x 1 = 0.2, and from equation (3), page 541, y P1 = y 0 + h(y ) 0 = 1 + 0.2(0) = 1
1 1
y = y 0 + 2 h (y ) 0 + f(x 1 , y P1 )
C1 = y 0 + 2 h (y ) 0 + x 1 (1 – 2y P1 )
1
= 1 + 2 (0.2) 0 + 0.2(1 - 2(1))
= 0.98
For line 3, x 1 = 0.4, and from equation (3), page 548, y P1 = y 0 + h(y ) 0 = 0.98 + 0.2(- 0.192)
810
= 0.9416
1 1
y = y 0 + 2 h (y ) 0 + f(x 1 , y P1 )
C1 = y 0 + 2 h (y ) 0 + x 1 (1 – 2y P1 )
1
= 0.98 + 2 (0.2) - 0.192 + 0.4(1 - 2(0.9416))
= 0.925472
For line 4, x 1 = 0.6, and from equation (3), page 548, y P1 = y 0 + h(y ) 0
= 0.85739648
1 1
y C 1 = y 0 + 2 h (y ) 0 + f(x 1 , y P1 ) = y 0 + 2 h (y ) 0 + x 1 (1 – 2y P1 )
1
= 0.925472 + 2 (0.2) - 0.3403776 + 0.6(1 - 2(0.85739648))
= 0.84854666
For line 5, x 1 = 0.8, and from equation (3), page 548, y P1 = y 0 + h(y ) 0
= 0.764895461
1 1
y = y 0 + 2 h (y ) 0 + f(x 1 , y P1 )
C1 = y 0 + 2 h (y ) 0 + x 1 (1 – 2y P1 )
1
= 0.84854666 + 2 (0.2) - 0.41825599 + 0.8(1 - 2(0.764895461))
= 0.76433779
For line 6, x 1 = 1.0, and from equation (3), page 548, y P1 = y 0 + h(y ) 0
= 0.679749698
1 1
y C 1 = y 0 + 2 h (y ) 0 + f(x 1 , y P1 ) = y 0 + 2 h (y ) 0 + x 1 (1 – 2y P1 )
1
= 0.76433779+ 2 (0.2) - 0.42294046 + 1.0(1 - 2(0.679749698))
= 0.68609380
812
EXERCISE 202 Page 557
dy y
3
1. Apply the Runge-Kutta method to solve the differential equation: dx x for the range
dy y
3
dx x
Let n = 0 to determine y 1 :
dy y 2
k1 f x 0 , y 0 3
2. = f (1, 2); since dx x , f (1, 2) = 3 - 1 = 1
2.05238095
=3- 1.05 = 1.045351476
k 4 f x 0 h, y 0 hk 3 f 1 0.1, 2 0.1(1.045351476)
5. = f (1.1, 2.1045351476)
2.1045351476
=3- 1.1 = 1.086786229
h
y y
k1 2k 2 2k 3 k 4
6. n 1 = n + 6 and when n = 0:
813
h 0.1
y
y1 = 0 + 6
k1 2k 2 2k 3 k 4 1 2(1.047619) 2(1.045351476) 1.086786229
=2+ 6
0.1
6.272727181
=2+ 6 = 2.10454545
n
xn yn
0 1.0 2.0
1 1.1 2.104545
2 1.2 2.216667
3 1.3 2.334615
4 1.4 2.457143
5 1.5 2.533333
Lines 1 and 2 have now been completed in the above table.
Let n = 1 to determine y 2 :
dy y 2.104545
k1 f x 0 , y 0 3
2. = f (1.1, 2.104545); since dx x , f (1.1, 2.104545) = 3 - 1.1
= 1.08677727
h h 0.1 0.1
k 2 f x 0 , y 0 k1 f 1.1 , 2.104545 (1.08677727) f 1.15, 2.15888386
3. 2 2 2 2
2.15888386
=3- 1.15 = 1.1227097
h h 0.1 0.1
k 3 f x 0 , y 0 k 2 f 1.1 , 2.104545 (1.1227097)
4. 2 2 2 2 = f 1.15, 2.1606805
2.1606805
=3- 1.15 = 1.1211474
k 4 f x 0 h, y 0 hk 3 f 1.1 0.1, 2.104545 0.1(1.1211474)
5. = f (1.2, 2.2166597)
2.2166597
=3- 1.2 = 1.15278355
h
y y
k1 2k 2 2k 3 k 4
6. n 1 = n + 6 and when n = 0:
h
y k 2k 2 2k 3 k 4
y1 = 0 + 6 1
0.1
1.08677727 2(1.1227097) 2(1.1211474) 1.15278355
= 2.104545 + 6
0.1
6.72727045
= 2.104545 + 6 = 2.216667
814
Line 3 has now been completed in the above table. In a similar manner y3 , y 4 and y5 can be
calculated.
1 dy
2y 1
2. Obtain a numerical solution of the differential equation: x dx using the Runge-Kutta
method in the range x = 0(0.2)1.0, given the initial conditions that x = 0 when y = 1.
1 dy 1 dy dy
2y 1 1 2y x(1 2y)
If x dx then x dx and dx
Let n = 0 to determine y 1 :
dy
k1 f x 0 , y 0 x(1 2y)
2. = f (0, 1); since dx , f (0, 1) = 0(1 - 2) = 0
h h 0.2 0.2
k 2 f x 0 , y 0 k1 f 0 , 1 (0) f 0.1, 1
3. 2 2 2 2 = 0.1(1 - 2) = -0.1
h h 0.2 0.2
k 3 f x 0 , y0 k 2 f 0 , 1 (0.1)
4. 2 2 2 2 = f 0.1, 0.99
= 0.1(1 – 1.98) = -0.098
k 4 f x 0 h, y 0 hk 3 f 0 0.2, 1 0.2(0.098)
5. = f (0.2, 0.9804)
Let n = 1 to determine y 2 :
dy
k1 f x1 , y1
2. = f (0.2, 0.980395); since dx = x(1 – 2y),
f (0.2, 0.980395) = 0.2(1 – 2(0.980395)) = -0.192158
815
h h 0.2 0.2
k 2 f x1 , y1 k1 f 0.2 , 0.980395 ( 0.192158) f 0.3, 0.9611792
3. 2 2 2 2
= 0.3(1 – 2(0.9611792) = -0.27670752
h h 0.2 0.2
k 3 f x1 , y1 k 2 f 0.2 , 0.980395 ( 0.27670752)
4. 2 2 2 2
f 0.3, 0.952724248
= = 0.3(1 – 2(0.952724248)) = -0.271634548
k 4 f x1 h, y1 hk 3 f 0.2 0.2, 0.980395 0.2( 0.271634548)
5.
= f (0.4, 0.92606809) = 0.4(1 – 2(0.92606809)) = -0.340854472
h
k1 2k 2 2k 3 k 4
6. y n 1 = yn + 6 and when n = 1:
h
k 2k 2 2k 3 k 4
y 2 = y1 + 6 1
0.2
0.192158 2(0.27670752) 2(0.271634548) 0.340854472
= 0.980395 + 6
0.2
1.629696608
= 0.980395 + 6 = 0.926071779
This completes the third row of the table below. In a similar manner y3 , y 4 and y5 can be calculated.
dy y
1
3. (a) The differential equation: dx x has the initial conditions that y = 1 at x = 2. Produce
a numerical solution of the differential equation, correct to 6 decimal places, using the
4 x
y
(b) If the solution of the differential equation by an analytical method is given by: x 2
816
dy y dy y y
1 1 1
(a) If dx x then dx x x
1. x 0 = 2, y 0 = 1 and since h = 0.1, and the range is from x = 2.0 to x = 2.5, then
Let n = 0 to determine y 1 :
dy y 1
1 1
k1 f x 0 , y 0 x , f (2, 1) = 2 = -1.5
2. = f (2, 1); since, dx
h h 0.1 0.1 0.925
k 2 f x 0 , y 0 k1 f 2.0 ,1.0 ( 1.5) f 2.05, 0.925 1
3. 2 2 2 2 = 2.05
= -1.451219512
h h 0.1 0.1
k 3 f x 0 , y 0 k 2 f 2.0 , 1.0 ( 1.451219512)
4. 2 2 2 2 = f 2.05, 0.927439024
0.927439024
1
= 2.05 = -1.45240928
0.854759072
1
= 2.1 = -1.40702813
h
k1 2k 2 2k 3 k 4
6. y n 1 = yn + 6 and when n = 0:
h
k 2k 2 2k 3 k 4
y1 = y0 + 6 1
0.1
1.5 2(1.451219512) 2(1.45240928) (1.40702813)
= 1.0 + 6
0.1
8.714285714
= 1.0 + 6 = 0.854762
Let n = 1 to determine y 2 :
dy y
1
k1 f x1 , y1 x ,
2. = f (2.1, 0.854762); since dx
0.854762
1
f (2.1, 0.854762) = 2.1 = - 1.407029524
817
h h 0.1 0.1
k 2 f x1 , y1 k1 f 2.1 , 0.854762 ( 1.407029524)
3. 2 2 2 2
0.784410523
1
= f(2.15, 0.784410523) = 2.15 = - 1.364842104
h h 0.1 0.1
k 3 f x1 , y1 k 2 f 2.1 , 0.854762 ( 1.364842104)
4. 2 2 2 2
0.786519894
1
f 2.15, 0.786519894
= = 2.15 = - 1.365823207
h
y y
k1 2k 2 2k 3 k 4
6. n 1 = n + 6 and when n = 1:
h
k 2k 2 2k 3 k 4
y 2 = y1 + 6 1
0.1
1.407029524 2(1.364842104) 2(1.365823207) 1.326445309
= 0.854762 + 6
0.1
8.194805455
= 0.854762 + 6 = 0.718182
This completes the third row of the Table below. In a similar manner y3 , y 4 and y5 can be
4 x
(b) If y = x 2 when x = 2.2, y = 0.718182
818
819