Docsity

Midterm exam 2 Solution - Numerical Analysis - 2008 | MATH 471, Exams of Mathematical Methods for Numerical Analysis and Optimization

Toggle sidebar
bg1
Midterm Exam II, Math 471
20 November, 2008
Name:
1. (25 points): (a) Write down the error formula for the Gauss quadrature approx-
imation of Zb
a
w(x)f(x)dx.(b) The weights in the Gauss quadrature formula are
given by
Wk=Zb
a
w(x) [Lk(x)]2dx.
Explain how the error formula implies that an equivalent way to find Wkis via
Wk=Zb
a
w(x)Lk(x)dx.
Solution: (a) The error formula is
Zb
aw(x)f(x)dx −
n
X
k=0
Wkf(xk) = Knf(2n+2)(ξ),
for some ξ∈(a, b), where
Kn=1
(2n+ 2)! Zb
aw(x) [πn+1(x)]2dx.
(b) The error formula indicates that if fis a polynomial of degree at most 2n+ 1,
then the error is zero. Suppose f(x) = Lj(x)∈ Pn, the jth Lagrange “L” polynomial
with respect to the quadrature points x0, x1,...,xn. Recall that Lj(xk) = δjk . Since
the degree of Ljis less than 2n+ 1 the Guass quadrature error is zero, and
Zb
a
w(x)Lj(x)dx =
n
X
k=0
WkLj(xk) =
n
X
k=0
Wkδjk =Wj.
The result is proven. ///
1
pf3
pf4
pf5

Partial preview of the text

Download Midterm exam 2 Solution - Numerical Analysis - 2008 | MATH 471 and more Exams Mathematical Methods for Numerical Analysis and Optimization in PDF only on Docsity!

Midterm Exam II, Math 471

20 November, 2008

Name:

  1. (25 points): (a) Write down the error formula for the Gauss quadrature approx- imation of

∫ (^) b

a

w(x)f (x) dx. (b) The weights in the Gauss quadrature formula are given by Wk =

∫ (^) b

a

w(x) [Lk(x)]^2 dx.

Explain how the error formula implies that an equivalent way to find Wk is via

Wk =

∫ (^) b

a

w(x)Lk(x) dx.

Solution: (a) The error formula is ∫ (^) b

a

w(x)f (x) dx −

∑^ n

k=

Wkf (xk) = Knf (2n+2)(ξ),

for some ξ ∈ (a, b), where

Kn =

(2n + 2)!

∫ (^) b

a

w(x) [πn+1(x)]^2 dx.

(b) The error formula indicates that if f is a polynomial of degree at most 2n + 1, then the error is zero. Suppose f (x) = Lj (x) ∈ Pn, the jth^ Lagrange “L” polynomial with respect to the quadrature points x 0 , x 1 ,... , xn. Recall that Lj (xk) = δjk. Since the degree of Lj is less than 2n + 1 the Guass quadrature error is zero, and ∫ (^) b

a

w(x)Lj (x) dx =

∑^ n

k=

WkLj (xk) =

∑^ n

k=

Wkδjk = Wj.

The result is proven. ///

  1. (25 points): (a) Construct orthogonal polynomials of degrees 0 and 1 on the interval (0, 1) with the weight function w(x) = − ln(x). (b) Use part (a) to show ∫ (^1)

0

(− ln(x)) f (x) dx = f

)

f ′′(ξ).

Hint: Use the formula

∫ (^1)

0

(− ln(x))xk^ dx =

(k + 1)^2

Solution: (a) First, set φ 0 ≡ 1. Using the Gram-Schmidt orthogonalization algo- rithm, q(x) = x − a 0 φ 0 (x), where

a 0 =

∫ (^1) ∫ 0 (−^ ln(x))xφ^0 (x)^ dx 1 0 (−^ ln(x)) [φ^0 (x)]

(^2) dx =

∫ (^1) ∫^0 (−^ ln(x))x dx 1 0 (−^ ln(x))^ dx^

1 (1+1)^2 1 (0+1)^2

Hence, choosing the free constant to be 1, we find

φ 1 (x) = x −

(b) We now use the error formula for the Gauss quadrature rule (as in the previous problem) using w(x) = − ln(x), n = 0, a = 0, and b = 1: ∫ (^1)

0

(− ln(x))f (x) dx = W 0 f (x 0 ) + K 0 f ′′(ξ),

for some ξ ∈ (0, 1), where

K 0 =

∫ (^1)

0

(− ln(x))(x − x 0 )^2 dx.

The quadrature point x 0 is the zero of φ 1 , where {φ 0 ≡ 1 , φ 1 } are orthogonal on [0, 1] with respect to the weight function w(x) = − ln(x). Using part (a) we find x 0 = 1/4. The quadrature weight is calculated from

W 0 =

∫ (^1)

0

w(x)L 0 (x) dx =

∫ (^1)

0

(− ln(x)) 1 dx =

(0 + 1)^2

Finally, calculating K 0 , we have

K 0 =

∫ (^1)

0

(− ln(x))(x − x 0 )^2 dx =

∫ (^1)

0

(− ln(x))

( x^2 −

x +

) dx

=

)

)

( 16 − 18 + 9 144

)

Plugging in the numbers yields the desired formula.

〈 f,

∑^ n

j=

αj ψj

〉 −

〈 (^) n ∑

k=

βkψk,

∑^ n

j=

αj ψj

〉

∑^ n j=

αj 〈f, ψj 〉 −

∑^ n

k=

∑^ n j=

βkαj 〈ψk, ψj 〉

∑^ n

j=

αj 〈f, ψj 〉 −

∑^ n

k=

∑^ n

j=

βkαj δjk

∑^ n

j=

αj 〈f, ψj 〉 −

∑^ n

j=

βj αj

∑^ n

j=

αj (〈f, ψj 〉 − βj ) = 0.

The result is proven. ///

  1. (25 points): Let f ∈ P 3 on the interval [a, b], and consider the knots a = x 0 < x 1 < · · · < xm = b. Let sH denote the Hermite cubic spline, and let s 2 denote the natural cubic spline, both interpolating f at the knots. (a) Carefully explain, using an error argument, why sH is identical to f. (b) Carefully explain why, in general, s 2 will not be identical to f.

Solution: (a) By Theorem 11.4,

‖f − sH ‖∞ ≤

h^4

∥∥ ∥f (4)

∥∥ ∥∞.

But note that, since f ∈ P 3 , f (4)^ ≡ 0. Hence ‖f − sH ‖∞ = 0, which implies sh ≡ f.

An alternate argument stems from Theorem 6.4. Suppose that s( Hi) is the “piece” of the spline defined on [xi− 1 , xi]. s( Hi) is the unique Hermite polynomial interpolating f at xi− 1 and xi. Note, n = 1, s( Hi) ∈ P 3 , and the error formula in Theorem 6. indicates f (x) − s( Hi) (x) =

f (4)(ξ) 4!

[π 2 (x)]^2 ,

for any x ∈ [xi− 1 , xi] and some ξ ∈ (xi− 1 , xi). But again, since f ∈ P 3 , f (4)^ ≡ 0, and s( Hi) ≡ f on [xi− 1 , xi]. This holds on all the intervals [xi− 1 , xi], for i = 1,... , n. Hence sH ≡ f on [a, b].

(b) Set f ′′(xi) = γi, and s′′ 2 (xi) = σi, i = 0,... , m. By construction, the natural cubic spline satisfies σ 0 = 0, but γ 0 6 = 0, in general. Likewise, σm = 0, but γm 6 = 0, in general. Since the second derivatives disagree at the end knots, the two functions cannot be identical, in general.