Here we assume the sample points of the integrand
are equally spaced:
|
(28) |
then we have
. We
further introduce another variable so that , and
, and the coefficients in
Eq. (25) can be written as:
These coefficients can be found by the following Matlab:
function c=coefs(n)
syms x
w=1;
for i=0:n
w=w*(x-i);
end
c=[];
for i=0:n
f=w/(x-i);
ci=int(f,[0,n])*(-1)^(n-i)/factorial(i)/factorial(n-i);
c=[c ci];
end
end
This integral of an nth-degree polynomial can be easily carried
out. The quadrature rule based on such coefficients is called the
Newton-Cotes formula:
|
(30) |
As mentioned before, in general the degree of accuracy of
is at least . We now further show that if the sample points are
equally spaced and if is even, the degree of accuracy of
is at least . Consider a polynomial integrand of degree ,
e.g.,
. We have
and the integration
error is
Since is even, is an integer. Introducing , we
further get
|
(32) |
The last equation is due to the fact that the integrand is an odd
function of . This result indicates that when is even, the
degree of accuracy of is at least .
Given the integrand and the quadrature rule, we need to
further determine the specific integration error
|
(33) |
If does not change sign in the interval , we
can further have
|
(34) |
according to the weighted mean-value theorem for integrals, where
. However, if does change signs in the
interval, this result is not valid and we have to try some other
method. In this case, we assume the integration error takes the
form
, where is a constant independent
of , if the degree of accuracy of is . This way,
is zero if but non-zero if ,
i.e., the degree of accuracy of is indeed . Next, to
find , we let
with
, and get
|
(35) |
Now the integration error can be found to be
|
(36) |
The last equation is due to Eq. (?) in the previous section,
where
can be found by either of two ways:
In the following, we will consider the Newton-Cotes quadrature and
its integration error for
.
- based on points, the trapezoidal rule:
|
(38) |
The trapezoidal rule is:
|
(40) |
To find the degree of accuracy, considering the follwoing
polynomial integrands:
-
:
|
(42) |
-
:
|
(44) |
can also be obtained as:
|
(45) |
As
, the degree of accuracy of is
. The general integration error is:
|
(46) |
- based on points, Simpson's rule:
|
(47) |
The Simpson's rule is:
|
(49) |
To find the degree of accuracy, considering the follwoing
polynomial integrands:
-
:
|
(51) |
-
:
|
(53) |
-
:
|
(55) |
can also be obtained as:
|
(56) |
As
, the degree of accuracy of the Simpson's rule is
( is even). The general integration error is:
|
(57) |
- based on points, Simpson's 3/8 rule:
|
(58) |
The quadrature rule is:
|
(60) |
The degree of accuracy can be found by considering the
follwoing polynomial integrands:
-
:
|
(62) |
-
:
|
(63) |
can also be obtained by:
|
(64) |
As
, the degree of accuracy is .
The general integration error is:
|
(65) |
- based on points, Boole's rule:
|
(66) |
The quadrature rule is:
The coefficients and integration errors for other quadrature rules
with higher can be similarly obtained.
Example:
Here we consider the integral of the normal (Gaussian)
distribution function with zero mean and unit standard
deviation :
|
(68) |
Twice of this value is the probability of taking a value within 3
standard deviations. This integral is carried out by each of the
four methods with different truncation errors. We see that as
increases, the error reduces.
|
(69) |