Page 8 - DOC-20220324-WA0012.-488-500
P. 8

472    Chapter 11 Systems of Ordinary Differential Equations

                            As a result of the preceding remarks, we sacrifice no generality in considering a system
                         of n + 1 first-order differential equations written as
                                  ⎧

                                  ⎪ x = f 0 (x 0 , x 1 , x 2 ,..., x n )
                                     0
                                  ⎪
                                  ⎪
                                  ⎪
                                  ⎪ x = f 1 (x 0 , x 1 , x 2 ,..., x n )
                                  ⎪
                                     1
                                  ⎪
                                  ⎪
                                  ⎪

                                  ⎨  x = f 2 (x 0 , x 1 , x 2 ,..., x n )
                                     2
                                       .
                                  ⎪    .
                                  ⎪    .
                                  ⎪
                                  ⎪
                                  ⎪
                                  ⎪ x = f n (x 0 , x 1 , x 2 ,..., x n )
                                  ⎪
                                  ⎪ n
                                  ⎪
                                  ⎩
                                    x 0 (a) = s 0 , x 1 (a) = s 1 , x 2 (a) = s 2 ,..., x n (a) = s n  all given
                         We can write this system in general vector notation as


                                                      X = F(X)
                                                                                              (7)
                                                      X(a) = S,  given
                         where
                                        ⎡   ⎤         ⎡   ⎤         ⎡  ⎤         ⎡   ⎤
                                         x 0            x             f 0          s 0
                                                         0
                                        ⎢   ⎥         ⎢  x    ⎥     ⎢  ⎥         ⎢   ⎥
                                         x 1                          f 1          s 1
                                        ⎢   ⎥         ⎢  1 ⎥        ⎢  ⎥         ⎢   ⎥
                                        ⎢   ⎥         ⎢  x    ⎥     ⎢  ⎥         ⎢   ⎥
                                         x 2                          f 2          s 2
                                    X = ⎢   ⎥    X = ⎢   2 ⎥    F = ⎢  ⎥     S = ⎢   ⎥
                                        ⎢ . ⎥         ⎢ . ⎥         ⎢ . ⎥        ⎢ . ⎥
                                          .             .             .            .
                                        ⎣ . ⎦         ⎣ . ⎦         ⎣ . ⎦        ⎣ . ⎦
                                         x n            x    n        f n          s n
                         A system of differential equations without the t variable explicitly present is said to be
                         autonomous. The numerical methods that we discuss do not require that x 0 = t or f 0 = 1
                         or s 0 = a.
                            For an autonomous system, the classical fourth-order Runge-Kutta method for
                         System (6) uses these formulas:
                                                         h
                                           X(t + h) = X +  (K 1 + 2K 2 + 2K 3 + K 4 )         (8)
                                                         6
                         where
                                                   ⎧
                                                     K 1 = F(X)
                                                   ⎪
                                                   ⎪
                                                   ⎪             1
                                                   ⎨
                                                     K 2 = F X + hK 1
                                                                 2

                                                                 1
                                                   ⎪ K 3 = F X + hK 2
                                                   ⎪             2
                                                   ⎪
                                                   ⎩
                                                     K 4 = F(X + hK 3 )
                         Here, X = X(t), and all quantities are vectors with n+1 components except the variables h.
                            In the previous example, the procedure RK4 System1 would need to be modified by
                         beginning the arrays with 0 rather than 1 and omitting the variable t. (We call it RK4 System2
                         and leave it as Computer Problem 11.1.4.) Then the calling programs would be as follows:
                            program Test RK4 System2
                            real h, t;  real array (x i ) 0:n
                            integer n ← 2, nsteps ← 100
                            real a ← 0, b ← 1
                            (x i ) ← (0, 1, 0)
                            h ← (b − a)/nsteps
                            call RK4 System2(n, h,(x i ), nsteps)
                            end program Test RK4 System2
   3   4   5   6   7   8   9   10   11   12   13