Page 275 - Applied Numerical Methods Using MATLAB
P. 275

264    ORDINARY DIFFERENTIAL EQUATIONS
           clue to the basic concept of numerical solution for a differential equation simply
           and clearly. Let’s consider a first-order differential equation:

                             y (t) + ay(t) = r  with y(0) = y 0          (6.1.1)

           It has the following form of analytical solution:
                                              r  −at   r

                                  y(t) = y 0 −  e   +                    (6.1.2)
                                              a        a
           which can be obtained by using a conventional method or the Laplace trans-
           form technique [K-1, Chapter 5]. However, such a nice analytical solution does
           not exist for every differential equation; even if it exists, it is not easy to
           find even by using a computer equipped with the capability of symbolic com-
           putation. That is why we should study the numerical solutions to differential
           equations.
              Then, how do we translate the differential equation into a form that can eas-
           ily be handled by computer? First of all, we have to replace the derivative

           y (t) = dy/dt in the differential equation by a numerical derivative (introduced in
           Chapter 5), where the step-size h is determined based on the accuracy require-
           ments and the computation time constraints. Euler’s method approximates the
           derivative in Eq. (6.1.1) with Eq. (5.1.2) as
                         y(t + h) − y(t)
                                       + ay(t) = r
                               h
                         y(t + h) = (1 − ah)y(t) + hr  with y(0) = y 0   (6.1.3)

           and solves this difference equation step-by-step with increasing t by h each time
           from t = 0.

                  y(h) = (1 − ah)y(0) + hr = (1 − ah)y 0 + hr
                                                    2
                 y(2h) = (1 − ah)y(h) + hr = (1 − ah) y 0 + (1 − ah)hr + hr  (6.1.4)
                                                    3      2         m
                 y(3h) = (1 − ah)y(2h) + hr = (1 − ah) y 0 +  (1 − ah) hr
                                                           m=0
                 . ... .. .. ... .. .. ... .. .. ... .. .. ... .. .. ... .. ..
           This is a numeric sequence {y(kh)}, which we call a numerical solution of
           Eq. (6.1.1).
              To be specific, let the parameters and the initial value of Eq. (6.1.1) be a = 1,
           r = 1, and y 0 = 0. Then, the analytical solution (6.1.2) becomes

                                      y(t) = 1 − e −at                   (6.1.5)
   270   271   272   273   274   275   276   277   278   279   280