Page 223 - Applied Numerical Methods Using MATLAB
P. 223

212    NUMERICAL DIFFERENTIATION/ INTEGRATION
           the step-size h, it seems that the errors continue to decrease as h gets smaller.
           However, this is only half of the story since we considered only the truncation
           error caused by truncating the high-order terms in the Taylor series expansion
           and did not take account of the round-off error caused by quantization.
              In this section, we will discuss the round-off error as well as the truncation
           error so as to gain a better understanding of how the computer really works. For
           this purpose, suppose that the function values

                        f(x + 2h), f (x + h), f (x), f (x − h), f (x − 2h)

           are quantized (rounded-off) to

                         y 2 = f(x + 2h) + e 2 ,  y 1 = f(x + h) + e 1

                                                                         (5.2.1)
                         y 0 = f(x) + e 0
                        y −1 = f(x − h) + e −1 ,  y −2 = f(x − 2h) + e −2

           where the magnitudes of the round-off (quantization) errors e 2 ,e 1 ,e 0 ,e −1 ,and
           e −2 are all smaller than some positive number ε,thatis, |e i |≤ ε. Then, the total
           error of the forward difference approximation (5.1.4) can be derived as

                       y 1 − y 0  f(x + h) + e 1 − f(x) − e 0 (5.1-4)  e 1 − e 0  K 1

            D f 1 (x, h) =    =                         = f (x) +       +    h
                         h                h                         h      2

                                  e 1 − e 0     |K 1 |  2ε  |K 1 |
                                                                        (2)
             |D f 1 (x, h) − f (x)|≤        +  h ≤  +     h   with K 1 = f  (x)
                                   h       2      h     2

           Look at the right-hand side of this inequality—that is, the upper bound of error.
           It consists of two parts; the first one is due to the round-off error and in inverse
           proportion to the step-size h, while the second one is due to the truncation error
           and in direct proportion to h. Therefore, the upper bound of the total error can
           be minimized with respect to the step-size h to give the optimum step-size h o as


                  d   2ε   |K 1 |     2ε   |K 1 |               ε
                         +     h =−      +     = 0,    h o = 2           (5.2.2)
                 dh   h     2         h 2   2                  |K 1 |
           Thetotal error of the central difference approximation (5.1.8) can also be derived
           as follows:

                               y 1 − y −1  f(x + h) + e 1 − f(x − h) − e −1
                    D c2 (x, h) =      =
                                  2h                  2h
                            (5.1.8)     e 1 − e −1  K 2  2

                             = f (x) +          +    h
                                          2h       6

                                 e 1 − e −1     |K 1 |  2ε  |K 2 |
                                               2             2           (3)
            |D c2 (x, h) − f (x)|≤        +   h ≤     +     h with K 2 = f  (x)
                                  2h        6      2h    6
   218   219   220   221   222   223   224   225   226   227   228