You are on page 1of 8

NUMERICAL ANALYSIS - SUMMER 2015

FINAL PROJECT
INSTRUCTOR: JIA LIU

DUE on 08/05 11:59pm C.T.


You can write on the separate work sheet or type your quiz. ( Word or
Latex or similar)
If you use the handwriting, Solutions must be neat,clear and legible.
If you need to scan you quiz, save it as a PDF file. Do not use jpeg, png,
jpg etc. Do not submit more than one files.
Please check your scanned file before submission. Make sure it is readable,
correct order, properly oriented. Make sure it does include all pages.
Please name your file as follows: LastnameInitials M ADquiz2.pdf .If
your name is Alan David Roberts, file name is RobertsADM ADquiz2.pdf .
Try to keep the file size less than 4MB.
You can resubmit the quiz if you want. Please specify which one is the one
to be graded. Otherwise I will grade the most recent version.
DO NOT EMAIL me the exam. All exams are submitted online at Drop
box.
Please include printouts of any functions and scripts used to produce your results. Please neatly organize the material you turn
in

Date: 07/27/2015.
1

INSTRUCTOR: JIA LIU

(1) Let



4 2
2 3
(a) Verify that the matrix A is Symmetric Positive Definite (SPD).
(b) Let


1
x=
2
and be a positive parameter. Determine all values of such that
the matrix A xxT is still SPD.
A=

NUMERICAL ANALYSIS - SUMMER 2015

FINAL PROJECT

(2) Take m = 50, n = 12. Using Matlabs linspace, define t to be the m-vector
corresponding to linearly spaced grid points from 0 to 1. Using Matlabs
vander and fliplr, define A to be the m n matrix associated with least
squares fitting on this grid by a polynomial of degree n 1. Take b to
be the function cos 4t evaluated on the grid. Now, calculate and print
( to sixteen-digit precision) the least squares coefficient vectors x by six
methods:
(a) Formation and solution of the normal equations, using Matlabs \,
(b) QR factorization computed by mgs (Modified Gram-Schmidt, from
quiz 5)
(c) QR factorization computed by house (Householder triangularization
from quiz 5)
(d) QR factorization computed by Matalbs qr
(e) x = A\b
(f) SVD, using Matlabs svd
(g) The calculations above will produce six lists of twelve coefficients. In
each list, shade with red pen the digits that appear to be wrong(due
to the rounding errors).
(h) Comment on what differences you observe.
(i) Explain your observations.

INSTRUCTOR: JIA LIU

(3) Let A R(n+m)(n+m) be symmetric positive definite, with




A11 A12
A=
AT12 A22
where A11 Rnn , A12 Rnm , A22 Rmm , and let L be the cholesky
factor of A, A = LLT . Partition L as


L11
0
L=
L21 L22
where L11 Rnn , L21 Rnm , L22 Rmm .
(a) Show that L22 LT22 = S where S = A22 AT12 A1
11 A12 is the Schur
complement of A11 in A.
(b) Using the foregoing relations to drive a block version of the Cholesky
factorization algorithm. Note that the algorithm should not require
any explicit matrix inversion.

NUMERICAL ANALYSIS - SUMMER 2015

FINAL PROJECT

(4) Linear systems that arise in many applications can become quite large. It
is often necessary to exploit any structure and /or sparsity in the matrices
to reduce the computation burden. We will consider the one-dimensional
Poisson equation: y 00 (t) = f (t) on [0,1], with y(0) = y(1) = 0.
Such problems are frequently very hard to handle because it is often
not possible to express y(t) in terms of elementary functions (as is done
in undergraduate courses on ODE). Numerical methods are employed in
order to approximate y(t) at discrete points inside the interval [a,b]. This
approach will leads to a linear system of equations (we will learn how in
the numerical PDE class).
The approach we consider begins by subdividing the interval [a,b] into
ba
: t0 = a, t1 = a + h, t2 =
n + 1 equal subintervals, each of length n+1
a + 2h, , tn = a + nh, tn+1 = b; The points ti = a + ih are called
ba
grid points, and the value h = n+1
is called the step size. Smaller step
sizes generally produce better approximations to the derivatives, so better
accuracy requires smaller step size, and hence larger number of grid points.
Let yi = y(ti ) and fi = f (ti ), and show that by using the finite difference
method, we can compute approximations to yi by solving the linear system
T y = h2 f , where

1
T =

1
..
.
..

..
.
..
.
1

y1

y2

, y =
..

.
1
yn
2

, f =

f1
f2
..
.

fn

(a) Prove that the matrix T has an LU factorization with L(i, i) = 1 and
i
L(i + 1, i) = i+1
, U (i, i) = i+1
i and U (i, i + 1) = 1.

(b) Is partial pivoting needed?

(c) Find a formula for the determinant of the matrix T. Explain how you
got this formula.

INSTRUCTOR: JIA LIU

(d) Write a Matlab function T = poissonmat(n) which created the n n


matrix T for given n.

(e) Write a Matlab function y = poissonsolve(f ) which, given a vector f


of length n, computes the solution y of T y = h2 f .

(f) Let f (t) = sin t, then the right hand side fi = sin (ti ). Experiment
with various values of n, say n = 10, 100, 500, 1000. Fill the following
table:
n
10
100
500
1000

h absolute error

residual CPU time

NUMERICAL ANALYSIS - SUMMER 2015

FINAL PROJECT

(5) We consider the approximations to the eigenvalues and eigenfunctions of


2
the one-dimensional Laplace Operator L[u] = ddxu2 on the unit interval
[0,1] with boundary u(0) = u(1) = 0. A scalar is an eigenvalue of L
if there exists a twice -differentiale function u s. t. u00 (x) = u(x) on
[0,1] with u(0) = u(1) = 0. In this case u is said to be an eigenfunction
of L corresponding to the eigenvalue . This continuous problem can be
approximated by the discrete eigenvalue problem
h2 TN u = u
where we have set

1
T =

1
..
.
..

..
.
..
.
1

u1
u2
..
.

, u =

1
un
2

with ui = u(xi ). It can be shown that the N N matrix TN has eigenvalues

j = 2(1cos Nj
+1 ) for j = 1 : N , corresponding to the eigenvectors uj (k) =
q
jk
2
N +1 sin( N +1 ) is the kth entry in uj . Noteice that the eigenvectors are
normalized w.r.t. the 2-norm. Also notice that eigenvalues of Tn lie in the
interval (0,4). Hence, the eigenvalues of h2 TN lie in the interval (0, 4(N +
1)2 ).

(a) Express the spectral condition number = N /1 of TN (which is the


same as the condition number of h2 TN ) as a simple function of N
for N .

(b) Use Matlab to plot the eigenvalues of TN for N = 21 (from smallest


to largest).

(c) Again using N = 21, use Matlab to plot the eigenvectors uj of TN


for j = 1, 2, 3, 5, 11, 21. The plot should be of the form (k, uj (k))

INSTRUCTOR: JIA LIU

where k = 1 : 21. Note that as j increases, the behavior of the


eigenvectors (approximate eigenfunctions) becomes increasingly oscillatory;these eigenfunctions are often called high energy modes.

(d) Write a Matlab code implementing the power method to compute


approximations of the largest eigenvalue N of L and corresponding
eigenfunctions. Use N = 500 and apply the algorithm to h2 TN . Start
with a random initial guess, use normalization in the 2-norm, and stope
when the difference of two subsequent approximate eigenvectors has
2-norm less than some prescribed tolerance . (e. g. = 106 ).
(i) Report the number of iterations performed
(ii) compared approximations with exact eigenvalue/eigenvector pair.
(iii) Use matalb to plot the computed eigenvector.

(e) (Bonus 20 pts) Write a Matlab code implementing the inverse power
method to compute approximations of the smallest eigenvalue 1 = 2
of L and corresponding eigenfunctions. Use N = 500 and apply the
algorithm to h2 TN . Start with a random initial guess, use normalization in the 2-norm, and stope when the difference of two subsequent
approximate eigenvectors has 2-norm less than some prescribed tolerance . (e. g. = 106 ).
(i) Report the number of iterations performed
(ii) compared approximations with exact eigenvalue/eigenvector pair.
(iii) Use matalb to plot the computed eigenvector.

You might also like