UNIT 13 NUMERICAL INTEGRATION
Structure
    13.1 Introduction
         Objectives
    13.2 Methods Based on Interpolation
         Methods Using Lagrange Interpolation
         Methods Using Newton's Forward Interpolation
    13.3 Composite Integration
I
    13.4 Romberg Integration
    13.5 Summary
    13.6 Solutions/Answers
    13.1 INTRODUCTION
    In Unit 12, w e developed methods of differentiation to obtain the derivative of a
    function f(x), when its values are not known explicitly, but are given in the form of a
    table. In this unit, w e shall now derive numerical methods for evaluating the definite
    integrals of such functions f(x). You may recall that in calculus, the definite integral of
    f(x) over the interval [a, b ] is d e f l e d as
                       b
                     Jaf(x) dx   -   lim R[b]
                                     h->O
    where R[h] is the left-end Riemann sum for n subintervals of length h = -and is
                                                                            n
    given by
    The need for deriving accurate numerical methods for evaluating the definite integral
    arises mainly, when the integral is either
        i) a mmplicated function such as f(x) = e-',   f(x) = *etc.     which have no
                                                                 X
           anti-derivatives expressible in terms of elementary functions, or
       ii) when the inregrand is given in the form of tables.
    Many scientific experiments lead to a table of values and we may not only require an
    approximation to the function f(x) but also may require approximate representation of
    the integral of the function. Moreover, analytical evaluation of the integral may lead to
    transcendental, logarithmic or circular functions. The evaluation of these functions for a
    given value of x may not be an accurate process. This motivates us to study numerical
    integration methods which can be easily implemented on calculators.
1   In this unit we shall develop numerical integration methods wherein the integral is
    approximated by a linear combination of the values of the integrand i.e.,
b
    where xo, xl, ......., x, a r e the points which divide the interval [a, b ] into n
    sub-intervals and Po, PI,        ........,
                                          P, are the weights to be determined. W e shall
    discuss in this unit, a few techniques to determine the unknowns in Eqn. (1).
Numerical Differentiation Integration
d d Solution of Differential Equations   Objectives
                                         After studying this unit you should be able to
                                            use trapezoidal and Simpson's rules of integration to integrate functions given in the
                                            form of tables and find the errors in these rules;
                                            improve the order of the results using ~ o m b e integration
                                                                                             r~          or its accuracy, by
                                            composite rules of integration.
                                         13.2      METHODS BASED ON INTERPOLATION
                                         In Block 3, you have studied several interpolation formulas, which fits the given
                                         data (x,', Q, k = 0, 1, 2, .........., n. We shall now see how these interpolation
                                         formulas can be used to develop numerical integration methods for evaluating the
                                         definite integral of a function which is given in a tabular form. The problem of
                                         numerical integration is to approximatc ine definite integral as a linear combination
                                         of the values of f(x) in the form
                                                              .I             n
                                         where the n + 1 distinct points xk, k = 0, 1, 2, ......, n are called the nodes or
                                         abscissas which divide the interval [a, b] into n sub-intervals (xo < xl < x2 < ..... xu)
                                         and &, k = 0, 1, .,..., n are called the weights of the integration rule or
                                         quadrature formula. We shall denote the exact value of the definite integral by I
                                         and denote the rule of integration by
                                                               n
                                         The error of approximating the integral I by Ih[fl is given by
                                                  E,, ifl =
                                                               b
                                                              J f(x) ax   - 2 a. .
                                                                             n
                                                                            k- 0
                                                                                     f,'
                                         The order of the integration method (3) is de%:.;,;das follows :
                                         Definition : An integration method of the form (3) is said to be of order p if it
                                         produces exact results for all polynomials of degree less than or,equal to p.
                                         In Eqn. (3) we have 2n + 2 unknowns viz., n + 1 nodes xk and the n + 1 weights
                                         and the method can be made exact for polynomials of degree 5 2n + 1. Thus, the
                                         method of the form (3) can be of maximum order 2n + 1. But, if some of the nodes are
                                         prescribed in advance, then the order will be reduced. If all the n + 1 nodes are
                                         prescribed, then we have to determine only n + 1 weights and the corresponding
                                         method will be of maximum order n.
                                         We first derive the numerical method based on Lagrange interpolation.
                                         13.2.1 Methods Using Lagrange Interpolation
                                         Suppose we are given the n + 1 abscissas x,'s and the corresponding values fk's. We
                                         know that the unique Lagrange interpolating polynomial Pn(x) of degree r n, satisfying
                                         the interpolatory conditions P,(xJ = f(xJ, k = 0, 1, 2, ......., n, is given by
                                                                     n
                                         with the error of interpolatioa
                                                                                                                       ..
                                            where 4 ( x ) =
                                                                   (x- x0) (x- xl)   '   ...(x- X,.-               .. . (x- x,)
                                                                                                        (x- X i + lJ
                                                                      xo) ('k- 1
                                                                               ')    ' ' ' ' (xk- xk- 1) (xk- Xk+ 1)   '''   (xt- x,)
and n (x) = (x-x,,)   (x-x,)     . . . (x-16).                                                            Numerical Integration
We replace the function f(x) in the definite integral (2) by the Lagrange interpolating
polynomial Pn(x) given by Eqn. (5) and obtain
where
                                Pk   -f 4(.)      dx.
The error in the integration rule is
We have
where M
      ,         = mar
                x,<x<x,
                          If"    ' (x) 1
Let us consider now the case when the nodes x,'s .are equispaced with x, = a, x, = b,
                                          b -a
and the length of each subinterval is h = 7e.      numerical integration methods
given by (7) are then known as Newton-Cotes formulas and the weight; k ' s given by
(8) are known as Cotes numbers. Any point x e [a, b] can be written as x = xo + sh.
With this substitution, we have
4(x) =
          4
          k ! (n- k)!
                      )(11)
Usinge x = xo + sh and changing the variable of integration from x to s, we obtain
'k-
      eh(s(s-1)(s-2)
      k !( n - L ) !
                                              .,... ( s - k + l ) ( s - k - 1 ) .... ( s - n ) L   (12)
and
      IE [fl I r hn+2Mn+1
                  (n+ I ) !
                                (s(S-      l)(s-2)      .. .(a-n)ds
We now derive some of the Newton Cotes formulas viz. trapezoidal rule and Simpson's
rule by using first and second degree Lagrange polynomials with equally spaced nodes.
You might bave studied these rules in your calculus course.
Trapezoidal Rule
When ir = 1, we bave xo = a, x,, = b and h = b-a. Using Eqn. (12) the Cotes numbers
can be found as
Substituting the values of       Po and          in Eqn.   (9,we get
I   Numerical Differentiation lotegration
    aod Solution of Differential Equations
                                             The error of integration is
1
                                             where        -
                                                     Mz max
                                                          Xo<X<X
                                                                   If   (x) 1                                                                  (16)
                                                                                b
                                             Thus, by trapezoidal rule,     $ f (x) dx       is given by
                                                      I                                       I
                                             The reason for calling this formula the trapezoidal mle is that geometrically when f(x)
                                             is a function with positive value then          -h2 (fo + fl) is the area of the trapezium with
                                             height h = b     - a and parallel sides as 6 and fl. This is an approximation to the actual
                                             area under the curve y = f(x) above the x-axis bounded by the ordinates x = x,,, x = x,.
                                             (see Fig. 1.). Since the error given by Eqn. (15) contains the second derivative,
                                             trapezoidal rule integrates exactly polynomials of degree s 1.
                                                                                                  Fig. 1
                                             Let us now consider an example.
                                             Example 1 : Find the approximate value of
                                             using trapezoidal rule and obtain a bound for the error. The exact value of I = ln2 =
                                             0.693142 correct to six decimal places.
                                             Solution : Here xo = 0, x, = 1 and h = 1 - 0 = 1. Using Eqn. (14), we get
                                             Actual error = 0.75 - 0.693147 = 0.056853.
                                             The error in the trapez            . rule   is given by
                                             Thus, the error bound obtaified is much greater than the actual error.
                                             We now       derive tbe Simpson's rule.
                                             Simpson's Rule
                                                                     b a
                                             For n = 2, w e have h = -, x0 = a, xl = -
                                                                                     a*b and x, = b.
                                                                      2               2
                                             From (12), we find the Cotes numbers as
                                                                            h
                                                                                              Numerical Integration
Eqn. (7) in tnis case rduces to
         Is [fI =   ,
                    h
                        [fo + 4fl + f2]
                                                                     b
Eqn. (17) is the Simpson's rule for approximating I =
                                                                     a
                                                                         f (x) dx   .
The magnitude of the error of integration is
               -    %                s(s- 1) (s- 2) ds +
                                                                               I
This indicates that Simpson's rule integrates polynomials of degree 3 also exactly.
Hence, we have to write the error expression (13) with n = 3. We find
                    h 5 ~
       1 41'11 s    *(s(s-                   1) (s- 2) (s- 3) ds
               -- $                  s(s- 1) (s- 2) (s- 3) ds +    s(s- 1) (s- 2) (s- 3) ds
where M, = max
           X0<X<X
                        ( f"   (x)   1
Since the error in Simpsm's rule contains the fourth derivative. Simpson's rule
integrates exactly all polynomials of degree 5 3.
                                         b
Thus, by Simpso~l'srule,         S f (x) dx
                                     a
                                                     is given by
Geometrically,
                 3 +,
                    fo 4f1 + f2 represents the area bounded by ihe quadratic curve
                                             I
passing through (xo f,), (x, ,fl) and (x2, f2) above the x-axis and lying between the
ordinates x = xo, x = x2 (see Fig. 2).
                                     Y
                                     t
                                                          Fig. 2
           DifferentiationIntegration    In case we are given only one tabulated value in the interval [a, b], then h = b - a, and
and Solution of Differential Equations
                                         the interpolating polynomial of degree zero is Pdx) = G, In this case, we obtain the
                                         rectangular integration rule given by
                                                                                                                     *
                                         The error in the integration rule is obtained h m Eqn. (13) as
                                         where M I= max 1 f (x) 1
                                                      acxcb
                                         If the given tabulated value in the interval [a, b] is the value at the mid-point, then we
                                         have xk = -,
                                                     a+b
                                                       2
                                                             and 4 =                               -
                                                                           In this case h = b a and we obtain the integration
                                                                         2
                                         rule as
                                         Rule (21) is called the mid-point rule. The error in the rule calculated from (13) is
                                         This shows that the mid-point rule integrates polynomials of degree one exactly. Hence
                                         the error for the mid-poht rule is given by
                                         where    M2= max ( f (x) 1 and h b- a
                                                         s<x+b
                                                                                 -
                                          We now illustrate these methods through an example.
                                                                        1   2
                                          Example 2 : Eva1uat.e e-a dx using
                                                                        0
                                          a) rectangular rule b) mid-point rule c) trapezoidal mle and d) Simpson's mle.
                                          If the exact value of the integral is 0.74682 correct to 5 decimal places, find the error
                                          in these rules.
                                                                                               1
                                          Solution : The values of the function f(x) = e-' at x = 0, 0.5 and 1 are
                                          Taking h = 1 and using
                                              a) IR[fl= h6, we get IR[fj=l.
                                             b) IM[fl= hfm, we get IM[fl= 0.7788.
                                              c) Idfl-    -h2 [f, + f,] ,we get Idfl- -21 (1+ 0.36788) = 0.68394 ,Taking h = 0.5 and
                                                 using Simpson's rule, we get
                                                      -   h
                                                              [f(O) + 4f(0.5) + f(l)]
                                                      -   0.74718.
                                          Exact value of the integral is 0.74682.
                                                                                                           Numerical lntegratibn
    The errors in these rules a& given by
    %[fj = 0.06288, E,[tJ = - 0.00036.
    You may now try tbe following exercise :
              Use the trapezoidal and Simpson's rule to approximate the following integrals. Compare
    El)
              the approximations to the actual value and find a bound for the error in each case.
                                                                                                       -
    We now d e ~ i v eintegration methods using Newton's forward interpolation formula.
    13.2~2 Methods Using ^Newton's Forward Interpolation
    Let the .data be given at equi-spaced nodal points xk = xo + sh, s = 0, 1, 2,      ........., n,
    where xo = a and x, = xo + nh = b.
    The step length is given by h =      -b. n-a
    The Newton's forward finite difference interpolation formula interpolating this data is given by
          -                         A2fo
    f(x) P,(x) = fo+ sAf0+ s(s- 1) -+ . . . +
                                      2
                                                  S(S- 1) (s- 2). . . (s- n+ I ) A O ~ ~
                                                                 n!
    with the error of interpolation
    Integrating both sides of Eqn. (23) w.r.t. x between the limits a and b, we can
    approximate the definite integral I by the numerical integration rule
    The error.of iilterpolation of (24) is given by
i
    We call obtain the trapezoidal rule (14) from (24) by using linear interpolation i.e., f(x)
      P,(x) = fO + s A fO. We then have
    with the error of integration given by (15).
    Similarly Simpson's rule (16) can be obtained from (24) by using quadratic
    interpolation i.e., f(x) = P2(x).
Numerical Differentiation Integration     ~     ~ xo = ka, xl =i xo +~h,   x2~=   xo    +   2h = 4 we have
and Solution o f Differential Equations
                                          The error of interpolation is given by Eqn. (18).
                                          Example 3 : Find the approximate value of I =              S,l+
                                                                                                       -dx
                                                                                                          x
                                                                                                              using
                                          Simpson's rule. Obtain the error bound and compare it with the actual error. qlso
                                          compare the result obtained here with the one obtained in Example 1.
                                                                                                       -1
                                          Solution : Here x, = 0, xl = 0.5, x2 = 1 and h =             -.2
                                          Using Simpson's rule, we have
                                          Exact value of I = In2 = 0.693147.
                                          Actual error = 0.001297. The bound for the error is given by
                                                            h5
                                                 IEs[fl 1 s -
                                                            90
                                                               M4= 0.00833, where M4= max
                                          Here too the actual error is less than the given bound.
                                          Also actual error obtained here is much less than that obtained in Example 1.
                                          You may now trv the following exercise.
                                                                                  1.5
                                          E2)    Find an approximation t o S exdx,using
                                                                            1.1
                                                 a) the trapezoidal rule with h = 0.4
                                                 b) Simpson's rule with h = 0.2
                                          The Newton-Cotes formulas as derived above are generally unsuitable for use over large
                                          integration intervals. Consider for instance, an approximation to
                                          (ex   dx, using Simpson's rule with h = 2. Here                                          C
                                          Since the exact value in this case is e4 - e0 = 53.59815, the error is -3.17143. This
                                          error is much larger than what we would generally regard as acceptable. However, large
                                          error is to be expected as the step length h = 2.0 is too large to make the er:or
                                          expression meaningful. In such cases, we would be required to use higher order
                                          formulas. An alternate approach to obtain more accurate results while using lower
                                          order methods is the use of composite integration methods, which we shail discuss in
                                          the next section.
                                                             -    -   - -               --         -    -
                                          13.3 COMPOSITE INTEGRATION
                                          In composite integration we divide the given interval [a, b] into a number of
                                          subintervals and evaluate the integral in each of the subintervals using one of the
ntegration rules. W e shall construct composite rules of integration for trapezoidal and
Simpson's methods and find the corresponding errors of integration when these
composite rules are used.
Composite Trapezoidal Rule
We divide the interval [a, b] into N subintervals of length h =         We denote the
subintervals as
                                                                   N
(xk-, ,xk), k = 1, 2,   . . ., N where xo = a, xN = b. Then
Evaluating each of the integrals on the right hand side by trapezoidal rule, we have
The method (26) is known as composite trapezoidal rule. The error is given by
Now since f is a continuous function on the interval [a, b], we have as a consequence
of Intermediate-value theorem
If   M2 = max 1 f (5) 1 . Then
                   "
          a<E,<b
                   (b-a) h2
          IEJfl Is -7%
The error is of order h2 and it decreases as h decreases.
Composite trapezoidal rule integrates exactly polynomials of degree r 1. We can try to
remember the formula (26) as
IT[fl = ):(   [first ordinate   + last ordinate + 2 (sun of the remaining ordinates)].
Composite Simpson's Rule
In using Simpson's rule of integration (17), w e need three abscissas. Hence, w e divide
the interval [a, b] into an even number of subintervals of equal length giving an odd
                                                                               b -a
number of abscissas in the form a = xo < x, < x2 < ...... < xZN = b with h =     -
                                                                                 2N
                                                                                      and
I
    Fjumerical Differentiation Integration   x, = X,   + kh, k = 0, 1, 2, ...,2N. We then write
)   and Solution of Differential Equations
                                                                                   N
                                                             1=     f ( x ) dx =
                                                                     a             k-1   'n-t
                                                                                                flx) dx
                                             Evaluating each of the integrals on the right hand side of Eqn. (28) by the Simpson's
                                             rule, we have
                                             I                N                                                                 1
                                             The formula (29) is known as the composite Simpson's rule of numerical integration.
                                             The error in (29) is obtained from (18) by adding up the errors. Thus we get
                                                                                          (b-a)
                                              If M4 = max fN (5) , we can write using h = -
                                                     asesb      I         I                2N
                                              The error is of order h4 and it approaches zero very fast as h -r 0. The rule integrates
                                              exactly polyfiomials of degree r 3. We can remember the composite Simpson's rule as
                                              I,[a   - (t) [first ordinate     + last ordinate + 2 (sum of even ordinates) + 4 (sum of the
                                                           remaining odd ordinates)]
                                              We now illustrate composite trapezoidal and Simpson's rule through examples.
                                              Example 4 : ~ v a l u s t e     (=
                                                                               bx
                                                                                  using
                                              (a) composite trapezoidal rule and (b) composite Simpson's rule witb 2, 4 and 8
                                              subintervals.
                                              Solution : We give in Table 1 the values of f(x) witb h =        -81 from x = 0 to x = 1.
                                                                                                  Table 1
                                              If N   = 2 then   h = 0.5 and the ordinates f , f4 and f8 are So be used.
                                              We get
IS[q ;-   1
      [G+ 4fl + fa]              - - 25
                                          0.694444
                                                                                                                                   Numerical Integration
It N = 4 then h = 0.25 and the ordinates                     6, f,,   f,,   4, fa are t6 be used.
We have
                                              I) -
       1
IT[q =, [fo + f8 + 2          4 + 4 + f6             0.697024
                             (
ff N = 8 then h = 1/8 and all the ordinates in Table 1 are to be used.
We obtain
The exact value of the given integral correct to six decimal places is 1112 = 0.693147.
We now give the actual errors in Table 2 below.
                                                          Table 2
Note that as h decreases the errors in both trapezoidal and Simpson's rule also decreases.
Let us consider another example.
Example 5 : Find the minimum number of intervals required to evaluate               with                    (*
                                                                                           -
an accuracy lo4, by using the Simpson rule.                                 ol+x
~olukon: In Example 4 you may observe From Table 2 that N         8 giver lo4 (l.E - 06)
accuracy. We shall now determine N from the theoretical error bound for Simpson's
rule which gives l.E - 06 accuracy. Now
where
                M, = max frV(x)
                       o<x< l
                                 I        I
To obtain the required accuracy we should therefore have
          .:
         N E 9.5
We find that we cannot take N = 9 since to make use of Simpson's rule we should
have even number ~C-intervals.We therefore conclude that N = 10 should be the
minimum number &f subintervals to obtain the accuracy l.E - 0.6 (i.e., lo4)
You may now try the following exercises :
                    dx
E3)       ~valuateJ----Z by subdividing the interval (0,l) into 6 equal p a w and using
                  ol+x
          /.I T r a n ~ 7 n i r l a ln r l p Ih\ Simncnn'c n ~ l pH p n r p f i n d thp v a 1 1 1nf
                                                                                                 ~ w and r r t l l a l ~ r r n m
    Numerical Differeatiation Integration           A 'function f(x) is given by the table
i   and Solution of Differential Equations   E4)
                                                    Find the integral of f(x) using (a) trapezoidal rule @) Simpson's rule.
                                             E5)    The speedometer reading of a car moving on a straight road is given. Estimate the
                                                    distance travelled by the car in 12 minutes using (a) Trapezoidal rule @) Simpson's
                                                    rule.
                                                    Time:     0                  2         4            6          8          10          12
                                                    (minutes)
                                                    Speedo- : 0                  15        25          40          45         20          0
                                                    meter
                                                    Reading
                                                                    0.4
                                             E6)     valuates       0.2
                                                                          (sin    - In x + ex) dx   using (a) Trapezoidal rule (b) Simpson's rule
                                                    taking h = 0.1.Find the actual errors.
                                             E7)    Determine N so that the composite trapezoidal rule gives the value of
                                                                                                                   2
                                                                                                                              I'   e-X dx correct
                                                    upto 3 digits after the decimal point, assuming that e-" can be calculated accurately.
                                             You must have realised that though the trapezoidal rule is the easiest Newton-Cotes
                                             formula to apply but it lacks the degree of accuracy generally required. There is a way
                                             to improve the accuracy of the results obtained by the trapezoidal and Simpson rules.
                                             This method is known as Romberg integration, or as extrapolation to the Limit.
                                             Richardson's extrapolation technique (ref. Sec. 12.5 of Unit 12) applied to the
                                             integration methods is called Romberg integration. We shall now discuss this technique
                                             in the next section.
                                             13.4 ROMBERG INTEGRATION
                                             In Romberg integration, first we find the power series expansion of the error term in
                                             the integration method. Then by eliminating the leading terms in the error expression, we
                                             obtain new values which are of higher order than the previously .computed values.
                                                           I
                                                        I
                                             If Fdh) de otes the approximate value obtained by using the composite trapezoidal rule, then
                                                          I = Fo(h) + c,h2 + c-)~+ ~ , h q+ . . . .
                                             where I is the exact value of the integral.
                                                                                                     . ..
                                                               gral be evaluated with the step lengths h,    -h2 and -
                                                                                                                     h
                                                                                                                     4'.
                                                       i
                                             Eliminati g C, from Eqns. (31) and (32), we get
                                                       I
                                             Note tha this value is of 0(h4). Similarly,
                                             etc.
                                                                                                    Numerical Integration
    Applying this method repeatedly by eliminating C2, then C3 etc. we get the Romberg
    integration formula
            Fm (h) =
                       4mFm-l (i)-    Fm-l('I
                                                 ,m=1,2,   ....                             (35)
                              4m-1
    In the same way if Go@) denote the value of the integral obtained by using the
    Simpson's rule, then
                 I = Go@) + d1h4+ d$6 + d,h8 + . . .
    where I is the exact value of the integ;al.
    Let the integral be evaluated with step lengths h, h/2 and h/4.
    Then, we have
                I = Go@) + d1h4+ d$6            + .. .
    Eliminating dl from Eqns. (36) and (37), we get
    Similar1y,
                  10
                       42G0   (t]- (i)
                                    Go
                              42- 1             = GI($)
    etc.
    Note that these values are of order h6.
    Applying extrapolation technique repeatedly, we get
    We now illustrate this technique through an example.
                                                              1
    Example 6 : Find the value of the integral I
                                                     0
                                                          =S                      1
                                                        f (x) dx where f (x) = -using
                                                                                1+ x
    (a) coinposite trapezoidal and (b) composite Simpson's rules, with 3, 5 and 9 nodes.
    Use extrapolation technique to improve the results.
I
    Solution : We take the computed values &om Example 4. The Romberg integration values are
I   given in Tables 3 and 4 for composite trapezoidal and composite Simpson's rules respectively.
I
                                                    Table 3
     Note that
                       4F0   (i)
                              - (i) Fo
             F1(i) =            3
Numerical Differentiation Integration
and Solutipn of Differential Equations
                                                                                   Table 4
                                         Note that
                                         Suppose that we wish to evaluate the integral in the above example directly by the
                                         trapezoidal and Simpson's rules to an accuracy 1.OE- 06. What should be the
                                         maximum value of step length to be chosen to achieve this accuracy ?
                                         T o answer this question let us calculate the error bound for trapezoidal rule.
                                                          h2                  h2             2       h2
                                                 IEJflJ s - max lf"(x)I                            >-
                                                          12 O < n < l
                                         Hence
                                                           or N 145.
                                         Thus to obtain l.E - 06 accuracy by trayezo~dalrule we need to use 145 subintervals,
                                         i.e., 146 function evaluations. But by extrapolation we have used only 9 evaluatio~lsand
                                         improved these values.
                                         Let us co~lsideranother example.
                                         Example 7 : Use co~npositetrapezoidal rule to find J f 2 l n x d x w i t h N = 3 , 6 , 1 2
                                         and improve the accuracy by Rotnberg integration.
                                         Solution : We give the result in the for111 of the followi~~gtable.
                                                                                   Table 5
           You may now try the following exercise.
       .   E8)     The followi~~g  table gives the values of I n x for x = 1, 2, ..., 11. Evaluate the
                   integral of the tabulated function using Trapezoidal rule with h = 1, 2. u s e
                   Richardson's extrapolation technique to improve the accuracy and obtain the
                   actual error. Compare the results obtained by using Simpson's rule with h = 1.
           We now end this unit by giving a summary of what we have covered in it.
           13.5 SUMMARY
           In this unit, we have learnt the following :
            1) If a function f(x) is not known explicitly but a table of values of x is given or when it
               has no anti-derivative expressible in terms of elementary functions then its integral
               cannot be obtained by calculus methods. In such cases numerical integration methods
               are used to find the definite integral of f(x) using the given data.
            2) The basic idea of numerical integration methods is to approximate the definite integral
               as a linear combination of the values of f(x) in the form
                 where the (n + 1) distinct nodes xk, k = 0, 1, ......, n, x,, < xl < x2 < ..... < x, divide
                 the integral [a, b] into n subinterirals and pk, k = 0, 1, ......, n are the weights of the
                 integration rule. The error of the integration methods is then given by
            3) For equispaced nodes, the integration formulas derived by using Lagrange
               interpolating polynomials P, (x) of degree s n, satisfying the interpolatory conditions
               P, (xJ = f (xJ, k = 0, 1, ..., n are known as Newton-Cotes formulas. Corresponding to
               n = 1 and n = 2, Newton-Cotes formulas viz., trapezoidal rule and Simpson's rule
               are obtained.
            4) For large integration intervals, the Newton-Cotes formulas are generally unsuitable for
                 they give large errors. Composite integration methods can be used in such cases by
:\4              dividing the interval into a large number of subintervals and evaluating the integral in
                 each of the subintervals using one of the integration rules.
            5) For improving the accuracy of the trapezoidal or Simpson's rules and to obtain higher
%I I           order solutions, Romberg's integration can be used.
                              h
             E l ) a) I,[fl = -
                              2
                                 [fo+ f,] = 0.346574
                              h
                      Is[f] = - Ifo+ 4f, + f2]
                              3
                              0.5
                            = -[4 In 1.5 + I n 21 = 0.385835
                               3
                        Exact value of I = 0.386294
I
        Numerical Differentiation Integration
                                                          Actual error in IT [ f j = 0.03972
I   I   and Solution of Differential Equations
                                                          Actual error in Is[fj = 0.000459
                                                          Also
                                                     b)   IT [fj = 0.023208 ,
                                                          I, [fj =0.032296,
                                                          Exact value = 0.034812         .
                                                                                 %[fj
                                                                                I+ 1
                                                     C) IT [fj = 0.39270,                    = 0.161
                                                        I, ~q= o.a4n8 ,                [fj = 0.00831
                                                          Exact value = 0.34657 .
                                                 E2) IT (q = 1.49718
                                                     I, [fj = 1.47754.
                                                                                         1
                                                 E3) With h = 116, the values of f(x) = -
                                                                                        1+xZ
                                                     from x = 0 to 1 are
                                                     Now
                                                            h
                                                      lT[q-y[fo + f6 + f 6 + 2f, t f,+f3 + f 4 +f,
                                                                                   (                       )I
                                                                                                       Exact n = 3.141593
                                                      Value of n fro111IT [fl = 4 x 0.784241 = 3.136963
                                                      Error in calculating n by IT [ f j is ETIfl = 0.004629
                                                      Value of n fr0111I, [fj= 4 x 0.785398 = 3.141592
                                                      Error in n by I, [fj is E, [fj = 1.0 x lod.
                                                 E4) I$fl   a   (k)
                                                                  [fo   t f4 + 2 (fl + f2 + f,)]
                                                                                   Numerical Integration
E5) Let vo = 0, vl = 15, v2 = 25, v3 = 40, v, = 45, v5 = 20, v6 = 0. Then
            12
     I=   S0     v dt, IT [v] =         + v6 + 2(v1 + v2 + V3 + V4 + v ~ )=] 290
E6) The values of f(x) = sin x = In x + ex are
     f (0.2) = 3.0295 1, f (0.3) = 2.849352, f (0.4) = 2.797534
     I, [fl =
                 04  [f (0:2) + 2f (0.3)   + f (0.4)] = 0.57629
     Exact value = 0.574056
     E, = 2.234 x loa3.
     Es = 9.2 x loa5.
E7) Error in composite trapezoidal rule
                 (b-a13
     %[fj=--      12NZ M 2 , M 2 = max Ifl'(x)J.
                                      o<x<1
     Thus
     f "' (x) = e-X'4x(3-2x2)     -   0 when x = 0, x =   a
     max I [f " (0) , f I ' (l)] I = max [2,2e-'1 = 2
     For getting the correct value upto 3 digits, we must have
    The intergel' value is N = 13.
E8) With h = 1, using trapezoidal rule
Numerical Differentiation Integration     With h = 2,
and Solution o f Differential Equations
                                          By extrapolation
                                                   1
                                          F, (h) = - [4F (h) - F (2h)]= 16.39496667
                                                   3
                                          By Simpson's rule
                                                                            5         4
                                          1.14 =   (t)[b   +   flo   +     Z fZ-] 2 C]
                                                                         . k-1
                                                                                 +
                                                                                     k-l
                                              = 16.39496667 (which is same as the value obtained by extrapolation)
                                          Exact value of the integral = 16.376848
                                          Actual error = 0.01811867.