Professional Documents
Culture Documents
Numerical Solutions of Ordinary Differential Equations: Exercises 6.1
Numerical Solutions of Ordinary Differential Equations: Exercises 6.1
Numerical Solutions of
Ordinary Differential Equations
Exercises 6.1
All tables in this chapter were constructed in a spreadsheet program which does not support subscripts. Consequently,
xn and yn will be indicated as x(n) and y(n), respectively.
1.
h = 0.1
x
y
1.00
5.0000
1.10
3.9900
1.20
3.2546
1.30
2.7236
1.40
2.3451
1.50
2.0801
h = 0.05
x(n)
y(n)
1.00
5.0000
1.05
4.4475
1.10
3.9763
1.15
3.5751
1.20
3.2342
1.25
2.9452
1.30
2.7009
1.35
2.4952
1.40
2.3226
1.45
2.1786
1.50
2.0592
2.
h = 0.1
x(n)
y(n)
0.00
2.0000
0.10
1.6600
0.20
1.4172
0.30
1.2541
0.40
1.1564
0.50
1.1122
h = 0.05
x(n)
y(n)
0.00
2.0000
0.05
1.8150
0.10
1.6571
0.15
1.5237
0.20
1.4124
0.25
1.3212
0.30
1.2482
0.35
1.1916
0.40
1.1499
0.45
1.1217
0.50
1.1056
3.
h = 0.1
x(n)
y(n)
0.00
0.0000
0.10
0.1005
0.20
0.2030
0.30
0.3098
0.40
0.4234
0.50
0.5470
h = 0.05
x(n)
y(n)
0.00
0.0000
0.05
0.0501
0.10
0.1004
0.15
0.1512
0.20
0.2028
0.25
0.2554
0.30
0.3095
0.35
0.3652
0.40
0.4230
0.45
0.4832
0.50
0.5465
266
Exercises 6.1
4.
h = 0.1
x(n)
y(n)
0.00
1.0000
0.10
1.1110
0.20
1.2515
0.30
1.4361
0.40
1.6880
0.50
2.0488
h = 0.05
x(n)
y(n)
0.00
1.0000
0.05
1.0526
0.10
1.1113
0.15
1.1775
0.20
1.2526
0.25
1.3388
0.30
1.4387
0.35
1.5556
0.40
1.6939
0.45
1.8598
0.50
2.0619
5.
h = 0.1
x(n)
y(n)
0.00
0.0000
0.10
0.0952
0.20
0.1822
0.30
0.2622
0.40
0.3363
0.50
0.4053
h = 0.05
x(n)
y(n)
0.00
0.0000
0.05
0.0488
0.10
0.0953
0.15
0.1397
0.20
0.1823
0.25
0.2231
0.30
0.2623
0.35
0.3001
0.40
0.3364
0.45
0.3715
0.50
0.4054
6.
h = 0.1
x(n)
y(n)
0.00
0.0000
0.10
0.0050
0.20
0.0200
0.30
0.0451
0.40
0.0805
0.50
0.1266
h = 0.05
x(n)
y(n)
0.00
0.0000
0.05
0.0013
0.10
0.0050
0.15
0.0113
0.20
0.0200
0.25
0.0313
0.30
0.0451
0.35
0.0615
0.40
0.0805
0.45
0.1022
0.50
0.1266
7.
h = 0.1
x(n)
y(n)
0.00
0.5000
0.10
0.5215
0.20
0.5362
0.30
0.5449
0.40
0.5490
0.50
0.5503
h = 0.05
x(n)
y(n)
0.00
0.5000
0.05
0.5116
0.10
0.5214
0.15
0.5294
0.20
0.5359
0.25
0.5408
0.30
0.5444
0.35
0.5469
0.40
0.5484
0.45
0.5492
0.50
0.5495
267
Exercises 6.1
8.
h = 0.1
x(n)
y(n)
0.00
1.0000
0.10
1.1079
0.20
1.2337
0.30
1.3806
0.40
1.5529
0.50
1.7557
h = 0.05
x(n)
y(n)
0.00
1.0000
0.05
1.0519
0.10
1.1079
0.15
1.1684
0.20
1.2337
0.25
1.3043
0.30
1.3807
0.35
1.4634
0.40
1.5530
0.45
1.6503
0.50
1.7560
9.
h = 0.1
x(n)
y(n)
1.00
1.0000
1.10
1.0095
1.20
1.0404
1.30
1.0967
1.40
1.1866
1.50
1.3260
h = 0.05
x(n)
y(n)
1.00
1.0000
1.05
1.0024
1.10
1.0100
1.15
1.0228
1.20
1.0414
1.25
1.0663
1.30
1.0984
1.35
1.1389
1.40
1.1895
1.45
1.2526
1.50
1.3315
h =
x(n)
0.00
0.10
0.20
0.30
0.40
0.50
0.1
y(n}
0.5000
0.5250
0.5498
0.5744
0.5986
0.6224
h =
x(n)
0.00
0.05
0.10
0.15
0.20
0.25
0.30
0.35
0.40
0.45
0.50
x(n)
0.00
0.10
0.20
0.30
0.40
0.50
h = 0.1
y(n}
2.0000
2.1220
2.3049
2.5858
3.0378
3.8254
10.
11.
exact
2.0000
2.1230
2.3085
2.5958
3.0650
3.9082
0.05
y(n}
0.5000
0.5125
0.5250
0.5374
0.5498
0.5622
0.5744
0.5866
0.5987
0.6106
0.6224
x(n)
0.00
0.05
0.10
0.15
0.20
0.25
0.30
0.35
0.40
0.45
0.50
h = 0.05
y(n}
2.0000
2.0553
2.1228
2.2056
2.3075
2.4342
2.5931
2.7953
3.0574
3.4057
3.8840
268
exact
2.0000
2.0554
2.1230
2.2061
2.3085
2.4358
2.5958
2.7997
3.0650
3.4189
3.9082
Exercises 6.1
12. (a)
(b)
h=0.1
x(n)
1.00
1.10
1.20
1.30
1.40
20
15
10
5
1.1
1.2
1.3
1.4
EULER
y(n)
1.0000
1.2000
1.4938
1.9711
2.9060
IMPROVED
EULER
y(n)
1.0000
1.2469
1.6668
2.6427
8.7988
(0.1)2
h2
= 4e2c
= 0.02e2c .
2
2
Since e2x is an increasing function, e2c e2(0.1) = e0.2 for 0 c 0.1. Thus an upper bound for the local
truncation error is 0.02e0.2 = 0.0244.
(c) Since y(0.1) = e0.2 = 1.2214, the actual error is y(0.1) y1 = 0.0214, which is less than 0.0244.
(d) Using the Euler method with h = 0.05 we obtain y(0.1) y2 = 1.21.
(e) The error in (d) is 1.2214 1.21 = 0.0114. With global truncation error O(h), when the step size is halved
we expect the error for h = 0.05 to be one-half the error when h = 0.1. Comparing 0.0114 with 0.214 we
see that this is the case.
14. (a) Using the improved Euler method we obtain y(0.1) y1 = 1.22.
(b) Using y = 8e2x we see that the local truncation error is
y (c)
(0.1)3
h3
= 8e2c
= 0.001333e2c .
6
6
Since e2x is an increasing function, e2c e2(0.1) = e0.2 for 0 c 0.1. Thus an upper bound for the local
truncation error is 0.001333e0.2 = 0.001628.
(c) Since y(0.1) = e0.2 = 1.221403, the actual error is y(0.1) y1 = 0.001403 which is less than 0.001628.
(d) Using the improved Euler method with h = 0.05 we obtain y(0.1) y2 = 1.221025.
(e) The error in (d) is 1.221403 1.221025 = 0.000378. With global truncation error O(h2 ), when the step size
is halved we expect the error for h = 0.05 to be one-fourth the error for h = 0.1. Comparing 0.000378 with
0.001403 we see that this is the case.
15. (a) Using the Euler method we obtain y(0.1) y1 = 0.8.
(b) Using y = 5e2x we see that the local truncation error is
(0.1)2
= 0.025e2c
2
e0 = 1 for 0 c 0.1. Thus an upper bound for the local
5e2c
Since e2x is a decreasing function, e2c
truncation error is 0.025(1) = 0.025.
(c) Since y(0.1) = 0.8234, the actual error is y(0.1) y1 = 0.0234, which is less than 0.025.
(d) Using the Euler method with h = 0.05 we obtain y(0.1) y2 = 0.8125.
(e) The error in (d) is 0.8234 0.8125 = 0.0109. With global truncation error O(h), when the step size is
halved we expect the error for h = 0.05 to be one-half the error when h = 0.1. Comparing 0.0109 with
0.0234 we see that this is the case.
269
Exercises 6.1
16. (a) Using the improved Euler method we obtain y(0.1) y1 = 0.825.
(b) Using y = 10e2x we see that the local truncation error is
10e2c
(0.1)3
= 0.001667e2c .
6
Since e2x is a decreasing function, e2c e0 = 1 for 0 c 0.1. Thus an upper bound for the local
truncation error is 0.001667(1) = 0.001667.
(c) Since y(0.1) = 0.823413, the actual error is y(0.1) y1 = 0.001587, which is less than 0.001667.
(d) Using the improved Euler method with h = 0.05 we obtain y(0.1) y2 = 0.823781.
(e) The error in (d) is |0.823413 0.8237181| = 0.000305. With global truncation error O(h2 ), when the step
size is halved we expect the error for h = 0.05 to be one-fourth the error when h = 0.1. Comparing 0.000305
with 0.001587 we see that this is the case.
17. (a) Using y = 38e3(x1) we see that the local truncation error is
y (c)
h2
h2
= 38e3(c1)
= 19h2 e3(c1) .
2
2
(b) Since e3(x1) is a decreasing function for 1 x 1.5, e3(c1) e3(11) = 1 for 1 c 1.5 and
y (c)
h2
19(0.1)2 (1) = 0.19.
2
(c) Using the Euler method with h = 0.1 we obtain y(1.5) 1.8207. With h = 0.05 we obtain y(1.5) 1.9424.
(d) Since y(1.5) = 2.0532, the error for h = 0.1 is E0.1 = 0.2325, while the error for h = 0.05 is E0.05 = 0.1109.
With global truncation error O(h) we expect E0.1 /E0.05 2. We actually have E0.1 /E0.05 = 2.10.
18. (a) Using y = 114e3(x1) we see that the local truncation error is
3
3
y (c) h = 114e3(x1) h = 19h3 e3(c1) .
6
6
(b) Since e3(x1) is a decreasing function for 1 x 1.5, e3(c1) e3(11) = 1 for 1 c 1.5 and
3
y (c) h 19(0.1)3 (1) = 0.019.
6
(c) Using the improved Euler method with h = 0.1 we obtain y(1.5) 2.080108. With h = 0.05 we obtain
y(1.5) 2.059166.
(d) Since y(1.5) = 2.053216, the error for h = 0.1 is E0.1 = 0.026892, while the error for h = 0.05 is E0.05 =
0.005950. With global truncation error O(h2 ) we expect E0.1 /E0.05 4. We actually have E0.1 /E0.05 =
4.52.
1
19. (a) Using y =
we see that the local truncation error is
(x + 1)2
2
1
h2
y (c) h =
.
2 (c + 1)2 2
(b) Since
1
1
1
is a decreasing function for 0 x 0.5,
270
Exercises 6.2
(c) Using the Euler method with h = 0.1 we obtain y(0.5) 0.4198. With h = 0.05 we obtain y(0.5) 0.4124.
(d) Since y(0.5) = 0.4055, the error for h = 0.1 is E0.1 = 0.0143, while the error for h = 0.05 is E0.05 = 0.0069.
With global truncation error O(h) we expect E0.1 /E0.05 2. We actually have E0.1 /E0.05 = 2.06.
2
20. (a) Using y =
we see that the local truncation error is
(x + 1)3
y (c)
(b) Since
1
h3
h3
=
.
3
6
(c + 1) 3
1
1
1
is a decreasing function for 0 x 0.5,
h3
(0.1)3
(1)
= 0.000333.
6
3
(c) Using the improved Euler method with h = 0.1 we obtain y(0.5) 0.405281. With h = 0.05 we obtain
y(0.5) 0.405419.
(d) Since y(0.5) = 0.405465, the error for h = 0.1 is E0.1 = 0.000184, while the error for h = 0.05 is E0.05 =
0.000046. With global truncation error O(h2 ) we expect E0.1 /E0.05 4. We actually have E0.1 /E0.05 =
3.98.
Exercises 6.2
h = 0.1
y(n}
2.0000
2.1230
2.3085
2.5958
3.0649
3.9078
1.
x(n)
0.00
0.10
0.20
0.30
0.40
0.50
exact
2.0000
2.1230
2.3085
2.5958
3.0650
3.9082
3.
x(n)
1.00
1.10
1.20
1.30
1.40
1.50
R-K
IMP EULER
y(n)
y(n)
2.0000
2.0000
2.1205
2.1220
2.3006
2.3049
2.5759
2.5858
3.0152
3.0378
3.7693
3.8254
y(n)
5.0000
3.9724
3.2284
2.6945
2.3163
2.0533
4.
x(n)
0.00
0.10
0.20
0.30
0.40
0.50
271
y(n)
2.0000
1.6562
1.4110
1.2465
1.1480
1.1037
Exercises 6.2
x(n)
0.00
0.10
0.20
0.30
0.40
0.50
y(n)
0.0000
0.1003
0.2027
0.3093
0.4228
0.5463
6.
x(n)
0.00
0.10
0.20
0.30
0.40
0.50
y(n)
1.0000
1.1115
1.2530
1.4397
1.6961
2.0670
7. x(n)
0.00
0.10
0.20
0.30
0.40
0.50
y(n)
0.0000
0.0953
0.1823
0.2624
0.3365
0.4055
8.
x(n)
0.00
0.10
0.20
0.30
0.40
0.50
y(n)
0.0000
0.0050
0.0200
0.0451
0.0805
0.1266
9.
x(n)
0.00
0.10
0.20
0.30
0.40
0.50
y(n)
0.5000
0.5213
0.5358
0.5443
0.5482
0.5493
10.
x(n)
0.00
0.10
0.20
0.30
0.40
0.50
y(n)
1.0000
1.1079
1.2337
1.3807
1.5531
1.7561
11.
x(n)
1.00
1.10
1.20
1.30
1.40
1.50
y(n)
1.0000
1.0101
1.0417
1.0989
1.1905
1.3333
12.
x(n)
0.00
0.10
0.20
0.30
0.40
0.50
y(n)
0.5000
0.5250
0.5498
0.5744
0.5987
0.6225
5.
t(n)
0.0
1.0
2.0
3.0
4.0
5.0
dv
= 32 0.025v 2 = f (t, v).
dt
(b)
v(t)
v(n)
0.0000
25.2570
32.9390
34.9772
35.5503
35.7128
40
30
20
10
0
+
dv = dt
2 32
32 0.025 v
32 + 0.025 v
and
1
ln | 32 + 0.025 v| ln | 32 0.025 v| = t + c.
2 32 0.025
Since v(0) = 0 we nd c = 0. Solving for v we obtain
16 5 (e 3.2 t 1)
v(t) =
e 3.2 t + 1
and v(5) 35.7678.
272
Exercises 6.2
14. (a) See the table in part (c) of this problem.
(b) From the graph we estimate A(1) 1.68, A(2) 13.2, A(3) 36.8, A(4) 46.9, and A(5) 48.9.
A(t)
50
40
30
20
10
0
dA
= dt
A( A)
1 1
+
dA = dt
A A
1
[ln A ln( A)] = t + c
A
ln
= (t + c)
A
A
= e(t+c)
A
A = e(t+c) Ae(t+c)
1 + e(t+c) A = e(t+c) .
Thus
A(t) =
e(t+c)
=
=
.
+ ec et
1 + e(t+c)
+ e(t+c)
+ ec
A(t)
t
A
A
A
(days)
1
(observed)
2.78
(approximated) 1.93
(exact)
1.95
2
13.53
12.50
12.64
2.128
.
0.0432 + 8.8235e2.128t
3
36.30
36.46
36.63
4
47.50
47.23
47.32
273
5
49.40
49.00
49.02
Exercises 6.2
15. (a)
x(n)
1.00
1.05
1.10
1.15
1.20
1.25
1.30
1.35
1.40
(b)
h = 0.05 h = 0.1
y(n)
y(n)
1.0000
1.0000
1.1112
1.2511
1.2511
1.4348
1.6934
1.6934
2.1047
2.9560
2.9425
7.8981
1.06E+15 903.0282
20
15
10
5
1.1
1.2
1.3
1.4
16. (a) Using the fourth-order Runge-Kutta method we obtain y(0.1) y1 = 1.2214.
(b) Using y (5) (x) = 32e2x we see that the local truncation error is
y (5) (c)
(0.1)5
h5
= 32e2c
= 0.000002667e2c .
120
120
Since e2x is an increasing function, e2c e2(0.1) = e0.2 for 0 c 0.1. Thus an upper bound for the local
truncation error is 0.000002667e0.2 = 0.000003257.
(c) Since y(0.1) = e0.2 = 1.221402758, the actual error is y(0.1) y1 = 0.000002758 which is less than
0.000003257.
(d) Using the fourth-order Runge-Kutta formula with h = 0.05 we obtain y(0.1) y2 = 1.221402571.
(e) The error in (d) is 1.221402758 1.221402571 = 0.000000187. With global truncation error O(h4 ), when
the step size is halved we expect the error for h = 0.05 to be one-sixteenth the error for h = 0.1. Comparing
0.000000187 with 0.000002758 we see that this is the case.
17. (a) Using the fourth-order Runge-Kutta method we obtain y(0.1) y1 = 0.823416667.
(b) Using y (5) (x) = 40e2x we see that the local truncation error is
40e2c
(0.1)5
= 0.000003333.
120
Since e2x is a decreasing function, e2c e0 = 1 for 0 c 0.1. Thus an upper bound for the local
truncation error is 0.000003333(1) = 0.000003333.
(c) Since y(0.1) = 0.823413441, the actual error is |y(0.1) y1 | = 0.000003225, which is less than 0.000003333.
(d) Using the fourth-order Runge-Kutta method with h = 0.05 we obtain y(0.1) y2 = 0.823413627.
(e) The error in (d) is |0.823413441 0.823413627| = 0.000000185. With global truncation error O(h4 ), when
the step size is halved we expect the error for h = 0.05 to be one-sixteenth the error when h = 0.1.
Comparing 0.000000185 with 0.000003225 we see that this is the case.
18. (a) Using y (5) = 1026e3(x1) we see that the local truncation error is
5
(5)
y (c) h = 8.55h5 e3(c1) .
120
(b) Since e3(x1) is a decreasing function for 1 x 1.5, e3(c1) e3(11) = 1 for 1 c 1.5 and
y (5) (c)
h5
8.55(0.1)5 (1) = 0.0000855.
120
(c) Using the fourth-order Runge-Kutta method with h = 0.1 we obtain y(1.5) 2.053338827. With h = 0.05
we obtain y(1.5) 2.053222989.
274
Exercises 6.3
19. (a) Using y (5) =
24
we see that the local truncation error is
(x + 1)5
y (5) (c)
(b) Since
h5
1
h5
=
.
120
(c + 1)5 5
1
1
1
is a decreasing function for 0 x 0.5,
h5
(0.1)5
(1)
= 0.000002.
5
5
(c) Using the fourth-order Runge-Kutta method with h = 0.1 we obtain y(0.5) 0.405465168. With h = 0.05
we obtain y(0.5) 0.405465111.
y
d x
[e y] = 10ex sin 3x = ex y = ex sin 3x 3ex cos 3x + c
dx
= y = sin 3x 3 cos 3x + cex .
5
(b) Using the fourth-order Runge-Kutta method with h = 0.1 we obtain the table of values shown. These values
are used to obtain an interpolating function in Mathematica. The graph of the interpolating function is
shown. Using Mathematicas root nding capability we see that the only positive root in [0, 2] is x = 1.53236.
x(n)
0.0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1.0
y(n)
0.0000
0.1440
0.5448
1.1409
1.8559
2.6049
3.3019
3.8675
4.2356
4.3593
4.2147
x(n)
1.0
1.1
1.2
1.3
1.4
1.5
1.6
1.7
1.8
1.9
2.0
y(n)
4.2147
3.8033
3.1513
2.3076
1.3390
0.3243
-0.6530
-1.5117
-2.1809
-2.6061
-2.7539
Exercises 6.3
1. For y y = x 1 an integrating factor is e
dx
= ex , so that
d x
[e y] = (x 1)ex
dx
and
y = ex (xex + c) = x + cex .
From y(0) = 1 we nd c = 1 and y = x + ex . Comparing exact values with approximations obtained in
Example 1, we nd y(0.2) 1.02140276 compared to y1 = 1.02140000, y(0.4) 1.09182470 compared to
275
Exercises 6.3
y2 = 1.09181796, y(0.6) 1.22211880 compared to y3 = 1.22210646, and y(0.8) 1.42554093 compared to
y4 = 1.42552788.
2. 100 REM ADAMS-BASHFORTH/ADAMS-MOULTON
110 REM METHOD TO SOLVE Y =FNF(X,Y)
120 REM DEFINE FNF(X,Y) HERE
130 REM GET INPUTS
140 PRINT
150 INPUT STEP SIZE=, H
160 INPUT NUMBER OF STEPS (AT LEAST 4)=,N
170 IF N<4 GOTO 160
180 INPUT X0 =,X
190 INPUT Y0 =,Y
200 PRINT
210 REM SET UP TABLE
220 PRINT X,Y
230 PRINT
240 REM COMPUTE 3 ITERATES USING RUNGE-KUTTA
250 DIM Z(4)
260 Z(1)=Y
270 FOR I=1 TO 3
280 K1=H*FNF(X,Y)
290 K2=H*FNF(X+H/2,Y+K1/2)
300 K3=H*FNF(X+H/2,Y+K2/2)
310 K4=H*FNF(X+H,Y+K3)
320 Y=Y+(K1+2*K2+2*K3+K4)/6
330 Z(I+1)+Y
340 X=X+H
350 PRINT X,Y
360 NEXT I
370 REM COMPUTE REMAINING X AND Y VALUES
380 FOR I=4 TO N
390 YP=Y+H*(55*FNF(X,Z(4))-59*FNF(X-H,Z(3))+37*FNF(X-2*H,Z(2))
-9*FNF(X-3*H,Z(1)))/24
400 Y=Y+H*(9*FNF(X+H,YP)+19*FNF(X,Z(4))-5*FNF(X-H,Z(3))+FNF(X-2*H,Z(2)))/24
410 X=X+H
420 PRINT X,Y
430 Z(1)=Z(2)
440 Z(2)=Z(3)
450 Z(3)=Z(4)
460 Z(4)=Y
470 NEXT I
480 END
276
Exercises 6.3
3.
x(n)
0.00
0.20
0.40
0.60
0.80
4.
x(n)
0.00
0.20
0.40
0.60
0.80
5.
x(n)
0.00
0.20
0.40
0.60
0.80
1.00
y(n)
1.0000
0.7328
0.6461
0.6585
0.7332
0.7232
initial condition
Runge-Kutta
Runge-Kutta
Runge-Kutta
predictor
corrector
y(n)
2.0000
1.4112
1.1483
1.1039
1.2109
1.2049
initial condition
Runge-Kutta
Runge-Kutta
Runge-Kutta
predictor
corrector
y(n)
0.0000
0.2027
0.4228
0.6841
1.0234
1.0297
1.5376
1.5569
initial condition
Runge-Kutta
Runge-Kutta
Runge-Kutta
predictor
corrector
predictor
corrector
x(n)
0.00
0.10
0.20
0.30
0.40
0.50
0.60
0.70
0.80
0.90
1.00
277
y(n)
0.0000
0.1003
0.2027
0.3093
0.4227
0.4228
0.5462
0.5463
0.6840
0.6842
0.8420
0.8423
1.0292
1.0297
1.2592
1.2603
1.5555
1.5576
initial condition
Runge-Kutta
Runge-Kutta
Runge-Kutta
predictor
corrector
predictor
corrector
predictor
corrector
predictor
corrector
predictor
corrector
predictor
corrector
predictor
corrector
Exercises 6.3
6.
x(n)
0.00
0.20
0.40
0.60
0.80
1.00
y(n)
1.0000
1.4414
1.9719
2.6028
3.3483
3.3486
4.2276
4.2280
initial condition
Runge-Kutta
Runge-Kutta
Runge-Kutta
predictor
corrector
predictor
corrector
x(n)
0.00
0.10
0.20
0.30
0.40
0.50
0.60
0.70
0.80
0.90
1.00
7.
x(n)
0.00
0.20
0.40
0.60
0.80
1.00
y(n)
0.0000
0.0026
0.0201
0.0630
0.1362
0.1360
0.2379
0.2385
initial condition
Runge-Kutta
Runge-Kutta
Runge-Kutta
predictor
corrector
predictor
corrector
x(n)
0.00
0.10
0.20
0.30
0.40
0.50
0.60
0.70
0.80
0.90
1.00
278
y(n)
1.0000
1.2102
1.4414
1.6949
1.9719
1.9719
2.2740
2.2740
2.6028
2.6028
2.9603
2.9603
3.3486
3.3486
3.7703
3.7703
4.2280
4.2280
initial condition
Runge-Kutta
Runge-Kutta
Runge-Kutta
predictor
corrector
predictor
corrector
predictor
corrector
predictor
corrector
predictor
corrector
predictor
corrector
predictor
corrector
y(n)
0.0000
0.0003
0.0026
0.0087
0.0201
0.0200
0.0379
0.0379
0.0630
0.0629
0.0956
0.0956
0.1359
0.1360
0.1837
0.1837
0.2384
0.2384
initial condition
Runge-Kutta
Runge-Kutta
Runge-Kutta
predictor
corrector
predictor
corrector
predictor
corrector
predictor
corrector
predictor
corrector
predictor
corrector
predictor
corrector
Exercises 6.4
8.
x(n)
0.00
0.20
0.40
0.60
0.80
1.00
y(n)
1.0000
1.2337
1.5531
1.9961
2.6180
2.6214
3.5151
3.5208
initial condition
Runge-Kutta
Runge-Kutta
Runge-Kutta
predictor
corrector
predictor
corrector
x(n)
0.00
0.10
0.20
0.30
0.40
0.50
0.60
0.70
0.80
0.90
1.00
y(n)
1.0000
1.1079
1.2337
1.3807
1.5530
1.5531
1.7560
1.7561
1.9960
1.9961
2.2811
2.2812
2.6211
2.6213
3.0289
3.0291
3.5203
3.5207
initial condition
Runge-Kutta
Runge-Kutta
Runge-Kutta
predictor
corrector
predictor
corrector
predictor
corrector
predictor
corrector
predictor
corrector
predictor
corrector
predictor
corrector
Exercises 6.4
1. The substitution y = u leads to the iteration formulas
un+1 = un + h(4un 4yn ).
yn+1 = yn + hun ,
The initial conditions are y0 = 2 and u0 = 1. Then
un+1 = un + h
2
2
u n 2 yn .
x
x
u = 4u 4y.
Using formula (4) in the text with x corresponding to t, y corresponding to x, and u corresponding to y, we
obtain
279
Exercises 6.4
Runge-Kutta method with h=0.2
m1
m2
m3
m4
k1
k2
k3
k4
0.2000
0.4400
0.5280
0.9072
2.4000
3.2800
3.5360
m1
m2
m3
m4
k1
k2
k3
0.1000
0.2443
0.1600
0.3298
0.1710
0.3444
0.2452
0.4487
1.2000
1.7099
1.4200
2.0031
1.4520
2.0446
u =
m2
m3
m4
k1
k2
k3
k4
1.8000
2.0000
2.0017
2.1973
2.0000
2.0165
1.9865
m2
m3
m4
k1
k2
k3
k4
0.9000
1.0000
0.9500
1.0500
0.9501
1.0501
0.9998
1.0998
1.0000
1.0000
1.0023
1.0019
0.9979
0.9983
u = 2u 2y + et cos t.
Using formula (4) in the text with y corresponding to x and u corresponding to y, we obtain
Runge-Kutta method with h=0.2
m1
m2
m3
m4
k1
k2
k3
k4
0.4000
0.4600
0.4660
0.5320
0.6000
0.6599
0.6599
m1
m2
m3
m4
k1
k2
k3
0.2000
0.2315
0.2150
0.2480
0.2157
0.2487
0.2315
0.2659
0.3000
0.3299
0.3150
0.3446
0.3150
0.3444
m1
m2
m3
m4
10.0000
8.7500
10.1563
13.2617
17.9712
0.0000
-2.5000
-4.3750
-6.3672
-8.8867
12.5000
13.4375
17.0703
22.9443
31.3507
0.00 1.0000
0.7170 0.20 1.4640
u
2.0000
2.6594
6.
k1
-20.0000
0.0000
-28.7500 -5.0000
-40.0000 -8.7500
-55.1758 -12.7344
-75.9326 -17.7734
k2
5.0000
4.3750
5.0781
6.6309
8.9856
280
k3
0.00 1.0000
0.3298 0.10 1.2155
0.3587 0.20 1.4640
u
2.0000
2.3150
2.6594
-5.0000
-10.6250
-16.0156
-22.5488
-31.2024
22.5000
29.6875
40.3516
55.3076
75.9821
Exercises 6.4
i1,i2
i1
7
6
5
4
i2
3
2
1
1
5t
7.
m1
m2
2.0000
m3
2.2800
2.3160
m4
2.6408
k1
1.2000
k2
1.4000
k3
k4
1.4280
0.00 6.0000
1.6632 0.20 8.3055
y
2.0000
3.4199
m2
1.0000
1.1494
m3
1.0700
1.2289
1.0745
1.2340
m4
1.1496
1.3193
k1
0.6000
0.7073
k2
0.6500
0.7648
k3
k4
0.6535
0.7688
0.00 6.0000
0.7075 0.10 7.0731
0.8307 0.20 8.3055
y
2.0000
2.6524
3.4199
x,y
20
xHtL
15
10
yHtL
5
0.5
1.5
2t
8.
m1
0.6000
m2
0.9400
m3
1.1060
m4
1.7788
k1
1.4000
k2
2.0600
k3
k4
2.3940
0.00 1.0000
3.7212 0.20 2.0785
y
1.0000
3.3382
m2
0.3850
0.6582
m3
0.4058
0.6925
m4
0.5219
0.8828
k1
0.7000
1.1291
k2
0.8650
1.4024
k3
0.9068
1.4711
281
k4
0.00 1.0000
1.1343 0.10 1.4006
1.8474 0.20 2.0845
y
1.0000
1.8963
3.3502
Exercises 6.4
x,y
50
40
yHtL
30
20
10
xHtL
0.5
1.5
2t
9.
m1
m2
m3
m4
k1
k2
k3
k4
m2
m3
m4
k1
k2
k3
k4
15
10
yHtL
5
5
10
15
20
25
30 t
-5
10.
m1
0.6400
m2
1.2760
m3
1.7028
m4
3.3558
k1
1.3200
k2
1.7720
k3
k4
2.1620
0.00 0.5000
3.5794 0.20 2.1589
y
0.2000
2.3279
m2
0.4790
1.0862
m3
0.5324
1.1929
m4
0.7816
1.6862
k1
0.6600
1.0117
k2
0.7730
1.2682
k3
0.8218
1.3692
282
k4
0.00 0.5000
1.0195 0.10 1.0207
1.7996 0.20 2.1904
y
0.2000
1.0115
2.3592
Exercises 6.4
x,y
2
xHtL
1.5
0.5
yHtL
0.1
0.2
0.3t
x = 2x + y + 5t
y = 2x + y 2t.
Runge-Kutta method with h=0.2
m1
m2
m3
m4
k1
k2
k3
k4
m2
m3
m4
k1
k2
k3
k4
x,y
1
-5
4t
xHtL
-10
-15
yHtL
-20
283
Exercises 6.4
12. Solving for x and y we obtain the system
1
y 3t2 + 2t 5
2
1
y = y + 3t2 + 2t + 5.
2
x =
m1
m2
m3
m4
k1
k2
k3
1.0910
1.0915
k4
m2
m3
m4
k1
k2
k3
0.5470
0.5457
0.5471
0.5457
k4
x,y
60
40
yHtL
20
2
-20
8t
xHtL
-40
-60
Exercises 6.5
1. We identify P (x) = 0, Q(x) = 9, f (x) = 0, and h = (2 0)/4 = 0.5. Then the nite dierence equation is
yi+1 + 0.25yi + yi1 = 0.
The solution of the corresponding linear system gives
x
y
0.0
0.5
1.0
1.5
4.0000 -5.6774 -2.5807 6.3226
2.0
1.0000
2. We identify P (x) = 0, Q(x) = 1, f (x) = x2 , and h = (1 0)/4 = 0.25. Then the nite dierence equation is
yi+1 2.0625yi + yi1 = 0.0625x2i .
The solution of the corresponding linear system gives
x
y
0.00
0.25
0.50
0.75
1.00
0.0000 -0.0172 -0.0316 -0.0324 0.0000
284
Exercises 6.5
3. We identify P (x) = 2, Q(x) = 1, f (x) = 5x, and h = (1 0)/5 = 0.2. Then the nite dierence equation is
1.2yi+1 1.96yi + 0.8yi1 = 0.04(5xi ).
The solution of the corresponding linear system gives
x
y
0.0
0.2
0.4
0.6
0.8
1.0
0.0000 -0.2259 -0.3356 -0.3308 -0.2167 0.0000
4. We identify P (x) = 10, Q(x) = 25, f (x) = 1, and h = (1 0)/5 = 0.2. Then the nite dierence equation is
yi + 2yi1 = 0.04.
The solution of the corresponding linear system gives
x
y
0.0
1.0000
0.2
1.9600
0.4
3.8800
0.6
0.8
1.0
7.7200 15.4000 0.0000
5. We identify P (x) = 4, Q(x) = 4, f (x) = (1 + x)e2x , and h = (1 0)/6 = 0.1667. Then the nite dierence
equation is
0.6667yi+1 1.8889yi + 1.3333yi1 = 0.2778(1 + xi )e2xi .
The solution of the corresponding linear system gives
x
y
0.0000
3.0000
0.1667
3.3751
0.3333
3.6306
0.5000
3.6448
0.6667
3.2355
0.8333
2.1411
1.0000
0.0000
6. We identify P (x) = 5, Q(x) = 0, f (x) = 4 x , and h = (2 1)/6 = 0.1667. Then the nite dierence equation
is
7. We identify P (x) = 3/x, Q(x) = 3/x2 , f (x) = 0, and h = (2 1)/8 = 0.125. Then the nite dierence equation
is
0.1875
0.0469
0.1875
1+
yi+1 + 2 +
y
yi1 = 0.
+
1
i
xi
x2i
xi
The solution of the corresponding linear system gives
x
y
1.000
5.0000
1.125
3.8842
1.250
2.9640
1.375
2.2064
1.500
1.5826
1.625
1.0681
1.750
0.6430
1.875
0.2913
2.000
0.0000
8. We identify P (x) = 1/x, Q(x) = x2 , f (x) = ln x/x2 , and h = (2 1)/8 = 0.125. Then the nite dierence
equation is
0.0625
0.0156
0.0625
yi+1 + 2 +
y
yi1 = 0.0156 ln xi .
1
+
1
+
i
xi
x2i
xi
The solution of the corresponding linear system gives
x
y
1.000
1.125
1.250
1.375
1.500
1.625
1.750
1.875
2.000
0.0000 -0.1988 -0.4168 -0.6510 -0.8992 -1.1594 -1.4304 -1.7109 -2.0000
9. We identify P (x) = 1 x, Q(x) = x, f (x) = x, and h = (1 0)/10 = 0.1. Then the nite dierence equation is
[1 + 0.05(1 xi )]yi+1 + [2 + 0.01xi ]yi + [1 0.05(1 xi )]yi1 = 0.01xi .
The solution of the corresponding linear system gives
285
Exercises 6.5
x
y
0.0
0.0000
0.1
0.2660
0.2
0.5097
0.3
0.7357
0.4
0.9471
0.5
1.1465
0.6
1.3353
0.7
1.5149
0.8
1.6855
0.9
1.8474
1.0
2.0000
10. We identify P (x) = x, Q(x) = 1, f (x) = x, and h = (1 0)/10 = 0.1. Then the nite dierence equation is
(1 + 0.05xi )yi+1 1.99yi + (1 0.05xi )yi1 = 0.01xi .
The solution of the corresponding linear system gives
x
y
0.0
1.0000
0.1
0.8929
0.2
0.7789
0.3
0.6615
0.4
0.5440
0.5
0.4296
0.6
0.3216
0.7
0.2225
0.8
0.1347
0.9
0.0601
1.0
0.0000
11. We identify P (x) = 0, Q(x) = 4, f (x) = 0, and h = (1 0)/8 = 0.125. Then the nite dierence equation is
yi+1 2.0625yi + yi1 = 0.
The solution of the corresponding linear system gives
x
y
0.000
0.0000
0.125
0.3492
0.250
0.7202
0.375
1.1363
0.500
1.6233
0.625
2.2118
0.750
2.9386
0.875
3.8490
1.000
5.0000
12. We identify P (r) = 2/r, Q(r) = 0, f (r) = 0, and h = (4 1)/6 = 0.5. Then the nite dierence equation is
0.5
0.5
1+
ui+1 2ui + 1
ui1 = 0.
ri
ri
The solution of the corresponding linear system gives
r
1.0
1.5
2.0
2.5
3.0
3.5
4.0
u 50.0000 72.2222 83.3333 90.0000 94.4444 97.6190 100.0000
286
14. Using h = 0.1 and, after shooting a few times, y (0) = 0.43535 we obtain the following table with the fourth-order
Runge-Kutta method.
x
y
0.0
1.00000
0.1
1.04561
0.2
1.09492
0.3
1.14714
0.4
1.20131
0.5
1.25633
0.6
1.31096
0.7
1.36392
0.8
1.41388
0.9
1.45962
1.0
1.50003
EULER
2.0000
2.1386
2.3097
2.5136
2.7504
3.0201
IMPROVED
EULER
2.0000
2.1549
2.3439
2.5672
2.8246
3.1157
RUNGE
KUTTA
2.0000
2.1556
2.3454
2.5695
2.8278
3.1197
h=0.05
x(n)
1.00
1.05
1.10
1.15
1.20
1.25
1.30
1.35
1.40
1.45
1.50
EULER
2.0000
2.0693
2.1469
2.2328
2.3272
2.4299
2.5409
2.6604
2.7883
2.9245
3.0690
IMPROVED
EULER
2.0000
2.0735
2.1554
2.2459
2.3450
2.4527
2.5689
2.6937
2.8269
2.9686
3.1187
RUNGE
KUTTA
2.0000
2.0736
2.1556
2.2462
2.3454
2.4532
2.5695
2.6944
2.8278
2.9696
3.1197
2. h=0.1
x(n)
0.00
0.10
0.20
0.30
0.40
0.50
EULER
0.0000
0.1000
0.2010
0.3049
0.4135
0.5279
IMPROVED
EULER
0.0000
0.1005
0.2030
0.3092
0.4207
0.5382
RUNGE
KUTTA
0.0000
0.1003
0.2026
0.3087
0.4201
0.5376
h=0.05
x(n)
0.00
0.05
0.10
0.15
0.20
0.25
0.30
0.35
0.40
0.45
0.50
EULER
0.0000
0.0500
0.1001
0.1506
0.2017
0.2537
0.3067
0.3610
0.4167
0.4739
0.5327
IMPROVED
EULER
0.0000
0.0501
0.1004
0.1512
0.2027
0.2552
0.3088
0.3638
0.4202
0.4782
0.5378
RUNGE
KUTTA
0.0000
0.0500
0.1003
0.1511
0.2026
0.2551
0.3087
0.3637
0.4201
0.4781
0.5376
287
EULER
0.5000
0.6000
0.7095
0.8283
0.9559
1.0921
IMPROVED
EULER
0.5000
0.6048
0.7191
0.8427
0.9752
1.1163
RUNGE
KUTTA
0.5000
0.6049
0.7194
0.8431
0.9757
1.1169
h=0.05
x(n)
0.50
0.55
0.60
0.65
0.70
0.75
0.80
0.85
0.90
0.95
1.00
EULER
0.5000
0.5500
0.6024
0.6573
0.7144
0.7739
0.8356
0.8996
0.9657
1.0340
1.1044
IMPROVED
EULER
0.5000
0.5512
0.6049
0.6609
0.7193
0.7800
0.8430
0.9082
0.9755
1.0451
1.1168
RUNGE
KUTTA
0.5000
0.5512
0.6049
0.6610
0.7194
0.7801
0.8431
0.9083
0.9757
1.0452
1.1169
4. h=0.1
x(n)
1.00
1.10
1.20
1.30
1.40
1.50
EULER
1.0000
1.2000
1.4760
1.8710
2.4643
3.4165
IMPROVED
EULER
1.0000
1.2380
1.5910
2.1524
3.1458
5.2510
RUNGE
KUTTA
1.0000
1.2415
1.6036
2.1909
3.2745
5.8338
h=0.05
x(n)
1.00
1.05
1.10
1.15
1.20
1.25
1.30
1.35
1.40
1.45
1.50
EULER
1.0000
1.1000
1.2183
1.3595
1.5300
1.7389
1.9988
2.3284
2.7567
3.3296
4.1253
IMPROVED
EULER
1.0000
1.1091
1.2405
1.4010
1.6001
1.8523
2.1799
2.6197
3.2360
4.1528
5.6404
RUNGE
KUTTA
1.0000
1.1095
1.2415
1.4029
1.6036
1.8586
2.1911
2.6401
3.2755
4.2363
5.8446
5. Using
yn+1 = yn + hun ,
y0 = 3
u0 = 1
we obtain (when h = 0.2) y1 = y(0.2) = y0 + hu0 = 3 + (0.2)1 = 3.2. When h = 0.1 we have
y1 = y0 + 0.1u0 = 3 + (0.1)1 = 3.1
u1 = u0 + 0.1(2x0 + 1)y0 = 1 + 0.1(1)3 = 1.3
y2 = y1 + 0.1u1 = 3.1 + 0.1(1.3) = 3.23.
6. x(n)
0.00
0.10
0.20
0.30
0.40
y(n)
2.0000
2.4734
3.1781
4.3925
6.7689
7.0783
initial condition
Runge-Kutta
Runge-Kutta
Runge-Kutta
predictor
corrector
288
0.0
0.0000
0.1
4.1987
0.2
0.3
0.4
0.5
0.6
8.1049 11.3840 13.7038 14.7770 14.4083
0.7
12.5396
289
0.8
9.2847
0.9
4.9450
1.0
0.0000