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

232                                        EXCEL NUMERICAL METHODS



                   If Err.Number = 13 Then
                     On Error GoTo 0   'Disable the error handler.
                     Resume ptl   'and continue execution.
                   Else
                     End  'Some other error, so quit completely
                   End If
                   End Sub
                            Figure 10-9. Fourth-order Runge-Kutta custom function
                                     for systems of differential equations.
                     (folder 'Chapter 10 Examples', workbook 'ODE Examples', module 'RungeKutta3')


                   Figures 10-1 0, 10-1 1 and 10- 12 illustrate the use of Runge3 to simulate some
               complex chemical reaction schemes.  Figure  10-1 0 shows concentration vs. time
               for the consecutive first-order reaction scheme
                                               A+B+C

               for which the differential equations are

                                                                                  (1 0-24)



                                                                                  (1 0-25)


                                                                                  (1 0-26)

                            0.005  1



                         $  0.004
                         E
                         i
                         .p  0.003
                         5
                         *
                         C
                         3  0.002
                         s
                         S
                                                                   >
                            0.001
                                                            I        -
                            0.000
                                  0       2        4        6        8       10
                                                 time, seconds

                     Figure 10-10.  Runge-Kutta simulation of consecutive
                      (folder 'Chapter  10 Examples', workbook 'ODE Examples',
   250   251   252   253   254   255   256   257   258   259   260