Composite Numerical Integration
The accuracy of the Quadrature formulae is a function of a fraction of the length of the integration interval. For integration over a larger interval, they tend to give rather large errors. For example:
> f:=x->cos(ln(x)):Int(f(x),x=1..11);exact:=evalf(value(%));
For Simpson's Rule:
> h:=evalf(10./2.):intn2:=h*(f(1.)+4*f(6.)+f(11.))/3.;err2:=abs(intn2-exact);
Even for n=4:
> h:=evalf(10./4.):intn4:=2*h*(7*f(1.)+32*f(7./2.)+12*f(6.)+32*f(17./2.)+7*f(11.))/45.;err4:=abs(intn4-exact);
>
One can, of course, split the integral in the sum of a number of integrals and apply these methods on each one of them separately. For example, let us split this interval in 4. Then
> Int(f(x),x=1..11)=Int(f(x),x=1..7/2)+Int(f(x),x=7/2..6)+Int(f(x),x=6..17/2)+Int(f(x),x=17/2..11);
>
Applying Simpson's Rule on these integrals then gives:
> intcn2:=0:h:=5/4.:for i from 0 to 3 do a:=1.+i*5/2.:b:=7/2.+i*5/2.:intcn2:=intcn2+h*(f(a)+4*f((a+b)/2.)+f(b))/3.: od:print(intcn2,abs(intcn2-exact));
Using the 5-point method yields:
> intcn4:=0:h:=5/8.:for i from 0 to 3 do a:=1.+i*5/2.:b:=7/2.+i*5/2.:intcn4:=intcn4+2*h*(7*f(a)+32*f(a+h)+12*f(a+2*h)+32*f(a+3*h)+7*f(b))/45.: od:print(intcn4,abs(intcn4-exact));
>
Compare this with the earlier results:
> print(`n=`.2,abs(intn2-exact),abs(intcn2-exact));
> print(`n=`.4,abs(intn4-exact),abs(intcn4-exact));
>
The idea of splitting the integration interval and appying a quadrature formula on each of the subintervals is called composite numerical integration.
>
Theorem 14 (Composite Simpson's Method)
Similarly, we can construct composite methods using the Trapezoidal Rule or the Midpoint rule. Here, the theorems are stated without proof:
Theorem 15 (Composite Trapezoidal Rule)
Theorem 16 (Composite Midpoint Rule)
>
One can show that these composite formulae are stable with respect to round-off error. If every calculation of a function value is subject to a round-off error then the round-off error in the end result is only proportional to the original bound on the round-off error!
>
Examples of use of these composite methods can be found in Worksheet 7.
>