Page 271 - Applied Numerical Methods Using MATLAB
P. 271

260    NUMERICAL DIFFERENTIATION/ INTEGRATION
                (b) Consider the following double integral:

                                          1     1            2
                                                1           π
                                   I =              dx dy =            (P5.14.2)
                                        0   0 1 − xy         6
                    Noting that the integrand function is singular at (x, y) = (1, 1),use
                    the routine “int2s()” and the MATLAB built-in routine “dblquad()”
                    with the upper limit (d) of the integration interval along the y-axis d
                    = 0.999, d= 0.9999, d= 0.99999 and d= 0.999999 to compute this
                    double integral. Fill in Tables P5.14.2 and P5.14.3 with the results and
                    the times measured by using the commands tic/toc to be taken for
                    carrying out each computation.


                    Table P5.14.1 Results of Running ‘‘int2s()’’ and ‘‘dblquad()’’ for (P5.14.1)
                             int2s(),     int2s(),     int2s(),
                            M=N=20       M =N=100     M=N=200       dblquad()
                     |error|            2.1649 × 10 −8             1.3250 × 10 −8
                     time



                    Table P5.14.2 Results of Running ‘‘int2s()’’ and ‘‘dblquad()’’ for (P5.14.2)
                                 a=0,b=1 a=0,b=1 a=0,b= 1 a = 0,b=1
                                    c=0,       c=0,        c=0,       c=0,
                                  d = 1-10 −3  d = 1-10 −4  d =1-10 −5  d = 1-10 −6
                    int2s()  |error|  0.0079               0.0024
                    M = 2000
                    N = 2000  time
                    dblquad  |error|            0.0004                 0.0006
                             time


                    Table P5.14.3 Results of Running the Double Integral Routine ‘‘int2s()’’ for
                    (P5.14.2)
                                               M = 1000,  M = 2000,  M = 5000,
                                               N = 1000   N = 2000   N = 5000
                     int2s()           |error|  0.0003
                     a=0,b=1
                     c = 0, d = 1-10 −4  time


                    Based on the results listed in Tables P5.14.2 and P5.14.3, answer the
                    following questions.
                    (i) Can we say that the numerical error becomes smaller as we set the
                       upper limit (d) of the integration interval along the y-axis closer to
                       the true limit 1?
   266   267   268   269   270   271   272   273   274   275   276