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

CHAPTER 11  ORDINARY DIFFERENTIAL EQUATIONS. PART I1                 259



                   In order to simplify the construction of the coefficients matrix, you can use
               the spreadsheet layout shown in Figure  11-14.  The formula in cell 17, which has
               been assigned the name top, is
                   =IF(ROW()-ROW(tOp)=COLUMN()-COLUMN(tOp),lNDlRECT("F"&ROW()),
                                                                        1
                   IF(ABS((ROW()-ROW(tOp))-(COLUMN()-COLUMN(tO~)))~l, ,O))
























                   Figure 11-14.  Coefficients matrix to solve the second-order differential equation
                                               y" -y = 0.
                     (folder 'Chapter  11 Examples', workbook 'ODE-BVP, worksheet 'Finite Difference 2')


                   To create the spreadsheet, do the following:
                   Enter  the  desired  range  of  x  values  in  column  A.  This  is  best  done  by
                   inserting rows within the range of x values, so as to preserve the formulas in
                   the last row.
                   Enter the boundary values of y in the first and last rows.
                   Enter values or expressions for the coefficients a, b and c in cells C13, D13
                   and E13, and Fill Down.
                   Select  cell  17  and  Fill  Down,  then  Fill  Right, to  create  the  coefficients
                   matrix.
                   Select the cell containing the formula for the results vector and Fill Down.
                   Enter the formula by pressing CONTROL+SHIFT+ENTER.


                   The results vector is shown in Figure 1 1 - 15 and a plot of the results in Figure
                11-16.
   277   278   279   280   281   282   283   284   285   286   287