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

11.1 Methods for First-Order Systems  469


                                    for k = 1 to nsteps do
                                       d 11 ← x 1 − x 2 + t(2 − t(1 + t))
                                                      2
                                       d 21 ← x 1 + x 2 + t (−4 + t)
                                       d 12 ← d 11 − d 21 + 2 − t(2 + 3t)
                                       d 22 ← d 11 + d 21 + t(−8 + 3t)
                                       d 13 ← d 12 − d 22 − 2 − 6t
                                       d 23 ← d 12 + d 22 − 8 + 6t
                                       d 14 ← d 13 − d 23 − 6
                                       d 24 ← d 13 + d 23 + 6
                                       for i = 1 to n do
                                                           1       1       1
                                           x i ← x i + h d i1 + h d i2 + h d i3 + h [d i4 ]
                                                           2       3       4
                                       end for
                                       t ← t + h
                                       output k, t,(x i )
                                    end for
                                    end program Taylor System2


                                Here, a two-dimensional array is used instead of all the different derivative variables; that
                                         ( j)
                                is, d ij ↔ x i  . In fact, this and other methods in this chapter become particularly easy to
                                program if the computer language supports vector operations.

                                Runge-Kutta Method

                                The Runge-Kutta methods of Chapter 10 also extend to systems of differential equations.
                                The classical fourth-order Runge-Kutta method for System (4) uses these formulas:

                                                                h
                                                  X(t + h) = X +  (K 1 + 2K 2 + 2K 3 + K 4 )         (6)
                                                                6
                                where

                                                       ⎧
                                                       ⎪ K 1 = F(t, X)
                                                       ⎪
                                                       ⎪
                                                       ⎪            1      1
                                                       ⎨
                                                         K 2 = F t + h, x + hk 1
                                                                    2      2

                                                                    1      1
                                                       ⎪ K 3 = F t + h, x + hk 2
                                                       ⎪            2      2
                                                       ⎪
                                                       ⎪
                                                       ⎩
                                                         K 4 = F(t + h, X + hK 3 )
                                Here, X = X(t), and all quantities are vectors with n components except variables t
                                and h.
                                    A procedure for carrying out the Runge-Kutta procedure is given next. It is assumed
                                that the system to be solved is in the form of Equation (4) and that there are n equations in
                                the system. The user furnishes the initial value of t, the initial value of X, the step size h, and
                                the number of steps to be taken, nsteps. Furthermore, procedure XP System(n, t,(x i ), ( f i ))
                                is needed, which evaluates the right-hand side of Equation (4) for a given value of array
                                (x i ) and stores the result in array ( f i ). (The name XP System2 is chosen as an abbreviation

                                of X for a system.)
   1   2   3   4   5   6   7   8   9   10