Docsity

Numerical Methods for Scientific Computing I - Assignment #5, Assignments of Mathematics

Toggle sidebar
bg1
MATH 571 Numerical Methods for Scientific Computing I Winter 2006
Assignment #5 due: Wednesday, March 29
1. Consider Ax =b. Let xbe the exact solution and let !xbe an approximate solution.
The error is e=x−!xand the residual is r=b−A!x.
(a) Show that Ae =rand ||e||
||x|| ≤κ(A)||r||
||b|| .
It follows that if Ais invertible, then e= 0 if and only if r= 0, but if Ais ill-conditioned,
then the relative error ||e||
||x|| may be large even if the relative residual ||r||
||b|| is small. This
occurs in the following example (due to W. Kahan).
A="1·2969 0·8648
0·2161 0·1441 #, b ="0·8642
0·1440 #, x ="2
−2#,!x1="0
1#,!x2="0·9911
−0·4870 #
(b) Show that Ax =b(using exact arithmetic). Consider !x1and !x2as approximate
solutions and for each one compute the corresponding ||e||∞
||x||∞
,||r||∞
||b||∞. Find κ∞(A).
2. Let A=
02−1
1 1 1
2 0 1
. Using Gaussian elimination and partial pivoting, find P, L, U
such that P A =LU.
3. Let Abe the 5-point discrete Laplacian on the unit square with h=1
4(so that Ais
a 9 ×9 matrix, the same as in class). Note that Ais a band matrix and furthermore it’s
sparse within the band. Suppose that Gaussian elimination without pivoting is performed,
and assume that the L, U factors are stored in the original matrix A. Draw a box around
each zero element of Athat gets filled in during the elimination. (Hint: this requires
no computation.) We already observed in class that Gaussian elimination preserves the
bandwidth of a band matrix, but this exercise shows that sparsity within the band may
be lost. In this case we say that fill-in occurs within the band.
4. Let A∈CI m×mbe hermitian. Show that the following statements are equivalent by
proving a⇒b⇒c⇒d⇒e⇒a.
a) The eigenvalues of Aare positive.
b) Ais positive definite.
c) ∆kis positive definite for k= 1, . . . , m, where ∆k=
a11 · · · a1k
.
.
..
.
.
ak1· · · akk
.
d) det ∆k>0 for k= 1, . . . , m
e) Ahas a Cholesky factorization.
5. Show that A=
4−2 1
−2 4 −2
1−2 4
is positive definite and find its Cholesky factorization.
6. page 177 (Cholesky factorization) 23.3
Use m= 1000 instead of m= 200. Record the elapsed times. For each part (a) to (g),
answer questions (i) and (ii) in the text.
pf2

Partial preview of the text

Download Numerical Methods for Scientific Computing I - Assignment #5 and more Assignments Mathematics in PDF only on Docsity!

MATH 571 Numerical Methods for Scientific Computing I Winter 2006

Assignment #5 due: Wednesday, March 29

  1. Consider Ax = b. Let x be the exact solution and let x˜ be an approximate solution.

The error is e = x − ˜x and the residual is r = b − A˜x.

(a) Show that Ae = r and

||e||

||x||

≤ κ(A)

||r||

||b||

It follows that if A is invertible, then e = 0 if and only if r = 0, but if A is ill-conditioned,

then the relative error

||e||

||x||

may be large even if the relative residual

||r||

||b||

is small. This

occurs in the following example (due to W. Kahan).

A =

, b =

, x =

, x˜ 1

, x˜ 2

(b) Show that Ax = b (using exact arithmetic). Consider ˜x 1

and ˜x 2

as approximate

solutions and for each one compute the corresponding

||e|| ∞

||x|| ∞

||r|| ∞

||b|| ∞

. Find κ ∞

(A).

  1. Let A =

. Using Gaussian elimination and partial pivoting, find P, L, U

such that P A = LU.

  1. Let A be the 5-point discrete Laplacian on the unit square with h =

1

4

(so that A is

a 9 × 9 matrix, the same as in class). Note that A is a band matrix and furthermore it’s

sparse within the band. Suppose that Gaussian elimination without pivoting is performed,

and assume that the L, U factors are stored in the original matrix A. Draw a box around

each zero element of A that gets filled in during the elimination. (Hint: this requires

no computation.) We already observed in class that Gaussian elimination preserves the

bandwidth of a band matrix, but this exercise shows that sparsity within the band may

be lost. In this case we say that fill-in occurs within the band.

  1. Let A ∈ CI

m×m

be hermitian. Show that the following statements are equivalent by

proving a ⇒ b ⇒ c ⇒ d ⇒ e ⇒ a.

a) The eigenvalues of A are positive.

b) A is positive definite.

c) ∆ k

is positive definite for k = 1 ,... , m, where ∆ k

a 11

· · · a 1 k

a k 1

· · · a kk

d) det ∆ k

0 for k = 1 ,... , m

e) A has a Cholesky factorization.

  1. Show that A =

is positive definite and find its Cholesky factorization.

  1. page 177 (Cholesky factorization) 23.

Use m = 1000 instead of m = 200. Record the elapsed times. For each part (a) to (g),

answer questions (i) and (ii) in the text.

  1. Let u(x, y) be the temperature in a square plate that is heated on one side and cooled

on the other three sides. The temperature u(x, y) satisfies the Laplace equation ∆u = 0 for

(x, y) in (0, 1) × (0, 1), with Dirichlet boundary conditions u(x, 1) = 1 , u(0, y) = u(1, y) =

u(x, 0) = 0.

a) Solve for u(x, y) using the 5-point discrete Laplacian with meshsize h = 2

−p

, p = 2 , 3 , 4 , 5.

Use Cholesky factorization to solve the linear system for u ij

≈ u(x i

, y j

). To simplify the

programming, you may use a full matrix (as opposed to a sparse representation). Display

the numerical solution u ij

for each value of h using a contour plot and a surface plot

(include the boundary values). The relevant commands in Matlab are contour and mesh

(or surf).

b) Present a table with the following data. column 1: h; column 2: u h

1

4

1

4

). Does the

numerical solution converge as h → 0? At what rate?

c) Something interesting happens at the northeast and northwest corners of the plate,

where the temperature jumps from u = 0 to u = 1. Based on the numerical results, what

is the limiting value of the exact solution u(x, y) as (x, y) approaches one of those corners

along various directions?