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

CHAPTER 15  RANDOM NUMBERS & MONTE CARLO METHOD                      353






















                  Figure 15-12.  Portion of table to calculate n by Buffon's Needle method.  There are
                                  2000 rows of calculation in the spreadsheet.
                  (folder 'Chapter 1 5 Examples', workbook 'Buffon's Needle', worksheet 'Calculation')


                   Figure 15-13 shows the result of recalculating the sheet 100 times, to provide
               a  total  of  200,000  calculations.  As  you  can  see,  the  calculation  does  not
                "converge''  very  efficiently.  Compare the  result  with  the  evaluation  of  n by
               evaluation of a series (Chapter 4) or by integration of a function (Chapter 7); both
               methods are much more efficient.
                                   -_-_  ~     l_l_l__l_ll-l

                          3.15  -

                          3.14  1

                          3.13  -

                          3.12   -

                          3.11  4)

                           3.1
                          3.09
                              0      50000    100000   150000   200000   250000
                                              Number of trials

                  Figure 15-13.  Approach of simulation result to the value n as the number of trials
                                                increases.
                  (folder 'Chapter 15 Examples', workbook 'Buffon's Needle', worksheet 'Many trials')
   371   372   373   374   375   376   377   378   379   380   381