Professional Documents
Culture Documents
497
(28)
k1 = h f (tk , yk ),
1
1
k2 = h f tk + h, yk + k1 ,
4
4
3
3
9
k3 = h f tk + h, yk + k1 + k2 ,
8
32
32
12
1932
7200
7296
k1
k2 +
k3 ,
k4 = h f tk + h, yk +
13
2197
2197
2197
439
3680
845
k1 8k2 +
k3
k4 ,
k5 = h f tk + h, yk +
216
513
4104
1
8
3544
1859
11
k6 = h f tk + h, yk k1 + 2k2
k3 +
k4 k5 .
2
27
2565
4104
40
yk+1 = yk +
25
1408
2197
1
k1 +
k3 +
k4 k5 ,
216
2565
4101
5
where the four function values f 1 , f 3 , f 4 , and f 5 are used. Notice that f 2 is not used
in formula (29). A better value for the solution is determined using a Runge-Kutta
method of order 5:
(30)
z k+1 = yk +
16
6656
28,561
9
2
k1 +
k3 +
k4 k5 + k6 .
135
12,825
56,430
50
55
The optimal step size sh can be determined by multiplying the scalar s times the
current step size h. The scalar s is
1/4
1/4
tol h
tol h
0.84
(31)
s=
2|z k+1 yk+1 |
|z k+1 yk+1 |
498
C HAP. 9
Table 9.10
tk
RK45 approximation
yk
True solution,
y(tk ) = tan(tk )
0
1
2
3
4
5
6
7
8
9
10
0.0
0.2
0.4
0.6
0.8
1.0
1.1
1.2
1.3
1.35
1.4
0.0000000
0.2027100
0.4227933
0.6841376
1.0296434
1.5574398
1.9648085
2.5722408
3.6023295
4.4555714
5.7985045
0.0000000
0.2027100
0.4227931
0.6841368
1.0296386
1.5774077
1.9647597
2.5721516
3.6021024
4.4552218
5.7978837
Error
y(tk ) yk
0.0000000
0.0000000
0.0000002
0.0000008
0.0000048
0.0000321
0.0000488
0.0000892
0.0002271
0.0003496
0.0006208
with
y(0) = 0
on
[0, 1.4].
An RKF45 program was used with the value tol = 2 105 for the error control
tolerance. It changed the step size automatically and generated the 10 approximations to
the solution in Table 9.10. An RK4 program was used with the a priori step size of h = 0.1,
which required the computer to generate 14 approximations at the equally spaced points in
Table 9.11. The approximations at the right endpoint are
y(1.4) y10 = 5.7985045
and
and
E 14 = 0.0059089
for the RKF45 and RK4 methods, respectively. The RKF45 method has the smaller
error.
S EC . 9.5
Table 9.11
499
tk
RK4 approximation
yk
True solution,
y(tk ) = tan(tk )
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
0.0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1.0
1.1
1.2
1.3
1.4
0.0000000
0.1003346
0.2027099
0.3093360
0.4227930
0.5463023
0.6841368
0.8422886
1.0296391
1.2601588
1.5574064
1.9647466
2.5720718
3.6015634
5.7919748
0.0000000
0.1003347
0.2027100
0.3093362
0.4227932
0.5463025
0.6841368
0.8422884
1.0296386
1.2601582
1.5574077
1.9647597
2.5721516
3.6021024
5.7978837
Error
y(tk ) yk
0.0000000
0.0000001
0.0000001
0.0000002
0.0000002
0.0000002
0.0000000
0.0000002
0.0000005
0.0000006
0.0000013
0.0000131
0.0000798
0.0005390
0.0059089