



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Numerical Computing S’09 MATH/CSCI 4800- Homework-6 Solutions
Due in class on Monday April 6, 2009
(a) If a quadrature rule Qn(f ) for an interval [a, b] is based on polynomial interpolation at n equally spaced points in the interval, what is the degree of the highest-degree polynomial that can be integrated exactly by this rule? (b) How will your answer to part (a) above change if you are at liberty to choose the placement of the n points? (c) What is a composite quadrature rule? Why is it preferred to a simple quadrature rule for numer- ically computing a definite integral with high accuracy? (d) Why is it important for all of the weights of a quadrature rule to be non-negative?
(a) The highest degree is n − 1 for n even, n for n odd. (b) Placement of the n nodes adds an extra n degrees of freedom, thereby increasing the degree of the exactly integrable polynomial by n. (c) A simple quadrature rule uses a high-degree polynomial interpolant to approximate the function being integrated, thereby yielding an error term that depends upon a high-order derivative of the integrand. A composite quadrature rule divides the interval of integration into a number of panels, and applies a low-order rule on each. The error term then involves only a low-order derivative of the integrand. For functions whose derivatives increase rapidly with the order of differentiation, the composite rule is therefore more accurate. (d) The condition number κ for an n -point quadrature rule for the integral
∫ (^) b a f^ (x)^ dx^ is
κ =
∑^ n
i=
|wi|,
where the wi are the weights. It is also known that
∑^ n
i=
wi = b − a.
If the wi are all positive, then the above equations show that κ is simply equal to b − a. If some of the weights are negative, then
κ =
∑^ n
i=
|wi| >
∑^ n
i=
wi = b − a.
i.e., the algorithm is less well-conditioned.
(a) Dividing the interval in half and using Simpson’s rule on each subinterval. (b) Using a closed Newton-Cotes rule with the same 5 points as nodes.
Support your answer with an error analysis. Test your conclusion experimentally with a few sample integrals. First, recall that Simpson’s rule is a 3-point rule, and when applied over the interval [a, b], yields the approximation
I(f ) =
∫ (^) b
a
f (x) dx =
h 3
f (a) + 4f
a + b 2
(b − a)^3 12 f ′′′(c), c ∈ [a, b].
Upon dividing the interval [a, b] into two halves and applying Simpson’s rule on each half, note that we are making use of 5 node points: a, a + h, a + 2h, a + 3h, and a + 4h ≡ b, h = (b − a)/ 4. The resulting composite Simpson’s rule is
I(f ) =
∫ (^) b
a
f (x) dx =
h 3
[f (a) + 4f (a + h) + 2f (a + 2h) + 4f (a + 3h) + f (b)] −
h^3 12
[f ′′′(c 1 ) + f ′′′(c 2 ),
where c 1 ∈ [a, a + 2h] and c 2 ∈ [a + 2h, b]. We can consolidate the error term and rewrite the above expression as
I(f ) =
∫ (^) b
a
f (x) dx = h 3
[f (a) + 4f (a + h) + 2f (a + 2h) + 4f (a + 3h) + f (b)] − h^3 6
f ′′′(c), c ∈ [a, b].
The closed 5-point Newton-Cotes rule, for which the error term is derived in problem 4(b) below, gives ∫ (^) a+4h
a
f (x) dx =
2 h 45
[7f (a) + 32f (a + h) + 12f (a + 2h) + 32f (a + 3h) + 7f (a + 4h) −
8 h^7 945
f (6)(c).
It is clear that for small values of h, the 5-point Newton-Cotes rule is more accurate unless f (x) is such that its 6th derivative is much larger than its 3rd derivative. In the latter case the composite Simpson’s rule may be more accurate. See the attached Matlab Log where the integrals
0
sin(0. 5 x) dx, I 2 =
0
sin(50x) dx.
are computed by each of the two methods. In the second integral the derivatives increase rapidly, and it is found that I 1 is computed more accurately by the Newton-Cotes rule and I 2 by the composite Simpson’s rule.
− 1 f^ (x)^ dx^ : Q(f ) = w[f (x 1 ) + f (x 2 ) + f (x 3 )].
This rule has unknown nodes and the same weight for all the terms. Find the weight and the nodes by using the conditions that the method is exact for f (x) = 1, x, x^2 ,... etc. What is the degree of precision of the resulting rule? Since there are 4 unknowns to be found, we require that the method be exact for the 4 monomials 1 , x, x^2 , and x^3 , and are led to the following equations.
3 w =
− 1
dx = 2, (1)
w(x 1 + x 2 + x 3 ) =
− 1
xdx = 0, (2)
w(x^21 + x^22 + x^23 ) =
− 1
x^2 dx =
w(x^31 + x^32 + x^33 ) =
− 1
x^3 dx = 0. (4)
(a) The integral is
I =
− 1
cos πx dx.
The Gaussian rule for n = 3 is (see Table on page 277 of the Text)
G 3 (f ) = w 1 f (x 1 ) + w 2 f (x 2 ) + w 3 f (x 3 )
where x 1 = −x 3 = − 1 /
3 , x 2 = 0, w 1 = w 3 = 5/ 9 , w 2 = 8/ 9. Application of the rule yields G 3 (f ) = 0.044908 which is also the error since the exact answer is 0. (b) The integral is
I =
1
x^2 ln x dx.
The transformation x = 2 + t leads to
− 1
(2 + t)^2 ln(2 + t) dt.
See attached Matlab log. The Matlab script is a modified version of the adaptive quadrature script provided on page 271 of the Text.