Page 277 - Excel for Scientists and Engineers: Numerical Methods
P. 277

254                                        EXCEL: NUMERICAL METHODS


               Finite-Difference Methods

                   As described in the following, approximating the derivative of a function by
               a finite difference quotient will allow us to reduce a boundary-value problem to a
               system of simultaneous equations that can be solved by methods that have been
               discussed in Chapter 9.  Problems that are difficult or impossible to solve by the
               shooting method may sometimes be solved by the finite-difference method.
                   Consider a two-point boundary value problem, where y is known at the ends
               of the  range  and  the  expression  for  the  second  derivative y"  is  given.  For  a
               differential equation of the general form
                                            y" + ay = bx + c                      (1 1-9)
               where a = F(x), we can replace the second derivative y" by the central difference
               formula
                                           1, - Yi+l - 2Yi  + Yi-1
                                          Y-                                     (1 1-10)
                                                    h2

               where h = Ax  (equation  1 1-1 O assumes equally spaced x values) to obtain
                                                                                 (1 1-1 1)


               where  xI  and  yj  represent  the  point  at  which  the  derivative  is  calculated.
               Rearranging equation 1 1  - 1 1 yields
                                                   +
                                   yl+1 + (h2a - 2)~, yI-l= h2 (bxj + C)         (1 1-12)
               We now divide the interval between the two boundary values into n equal parts to
               yield n simultaneous equations obtained from equation  11-12.  The procedure is
               best illustrated by an example.

               Solving a Second-Order Ordinary Differential Equation
               by the Finite-Difference Method
                   We wish to solve the boundary value problem

                                                                                 (1 1-13)


               with boundary values y = 2 at x = 1 and y = -1  at x = 3.  The differential equation
               is of the general form of equation  11-9 with a = -(0.15-x/2.3),  b = 1 and c = 0.
               For this simple example, we will subdivide the x interval, x = 1 to x = 3, into ten
               subintervals; thus h = 0.2 and the x values defining the subintervals (sometimes
               called the meshpoints) are x1 = 1 .O,  x2  = 1.2, . . ., x11 = 3.0.  We can now write an
               equation of the form
   272   273   274   275   276   277   278   279   280   281   282