4 Computing Integrals

Index - - Contents - - Previous chapter - Next chapter - - Previous page - Next page

4.1 The main idea

Determining areas and volumes of bodies given in analytical form, also called quadrature, is an important problem in science. (See also Section 1.2)

The integral of f(x) over the region A can be computed as the volume of A, V(A) times the average of f(x) in A, i.e.

       (                  
  I =  / f(x) dx = V(A) * [f(x1)+f(x2)+...+f(xn)]/n
       )
       A  
 
where x1,...,xn are points distributed "evenly" over A. We may thus sample N points in H and record the points x1,...,xn falling in A. From this we may estimate V(A) as
       V(A) = (n/N) * V(H)
If for instance n = 3 and H is the box (a1, b1) x ( a2, b2) x (a3, b3) then
       V(H) = (b1-a1)(b2-a2)(b3-a3)
With this we obtain
        I = (n/N) * V(H) * [f(x1)+f(x2)+...+f(xn)]/n        
          = [V(H)/N] * [f(x1)+f(x2)+...+f(xn)]

Using a box G with double the sides of H we have

       V(G) = 2(b1-a1)* 2(b2-a2)* 2(b3-a3) 
            = 8* (b1-a1)(b2-a2)(b3-a3)
            = 8* V(H)
 
In order to get the same accuracy we want the n for sampling in G to be the same as for sampling in H, so we may write
       V(A) = (n/N) * V(H) = (n/N') * V(G)
=>
              (n/N) * V(H) = (n/N') * 8* V(H)
=>
              1/N = (1/N') * 8
=>
              N' = 8* N
which means that in G we should use 8 times the number of points used in H. This shows the importance to choose H as small as possible.