Computer Assignment #3 - Numerical Linear Algebra | MATH 477, Assignments of Linear Algebra

Material Type: Assignment; Class: Numerical Linear Algebra; Subject: Mathematics; University: Illinois Institute of Technology; Term: Fall 2006;

Typology: Assignments

Pre 2010

Uploaded on 08/18/2009

koofers-user-r0o
koofers-user-r0o 🇺🇸

9 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Math 477/577 Computer Assignment 3, due Oct.12, 2006
1. Write a Matlab function [Q,R] = mgs(A) (see the discussion in the classnotes of stability of
the Gram-Schmidt algorithms) that computes a reduced QR factorization A=ˆ
Qˆ
Rof an m×n
matrix Awith mnusing modified Gram-Schmidt orthogonalization. The output variables
are a matrix QCm×nwith orthonormal columns and a triangular matrix RCn×n.
2. (a) Write a Matlab program that sets up a 15 ×40 matrix with entries 0 everywhere except
for the values 1 in the positions indicated in the picture below. The upper-leftmost 1 is in
position (2,2), and the lower-rightmost 1 is in position (13,39). This picture was produced
with the command spy(A).
0 5 10 15 20 25 30 35 40
0
5
10
15
(b) Call svd to compute the singular values of A, and print the results. Plot these numbers
using both plot and semilogy. What is the mathematically exact rank of A? How does
this show up in the computed singular values?
(c) For each ifrom 1 to rank(A), construct the rank-imatrix Bthat is the best approximation
to Ain the 2-norm. Use the command pcolor(B) with colormap(gray) to create images
of these various approximations.
3. (a) Write a Matlab function [W,R] = house(A) that computes an implicit representation of
a full QR factorization A=QR of an m×nmatrix Awith mnusing Householder
reflections. The output variables are a lower-triangular matrix WCm×nwhose columns
are the vectors vkdefining the successive Householder reflections, and a triangular matrix
RCn×n.
(b) Write a Matlab function Q = formQ(W) that takes the matrix Wproduced by house as
input and generates a corresponding m×morthogonal matrix Q.
4. Let Zbe the matrix
Z=
1 2 3
4 5 6
7 8 7
4 2 3
4 2 2
.
Compute the reduced QR factorization of Zin Matlab: by the Gram-Schmidt routine mgs
of Problem 1, by the Householder routines house and formQ of the previous problem, and
by Matlab’s built-in command [Q,R] = qr(Z,0). Compare these three and comment on any
differences you see.

Partial preview of the text

Download Computer Assignment #3 - Numerical Linear Algebra | MATH 477 and more Assignments Linear Algebra in PDF only on Docsity!

Math 477/577 — Computer Assignment 3, due Oct.12, 2006

  1. Write a Matlab function [Q,R] = mgs(A) (see the discussion in the classnotes of stability of the Gram-Schmidt algorithms) that computes a reduced QR factorization A = Qˆ Rˆ of an m × n matrix A with m ≥ n using modified Gram-Schmidt orthogonalization. The output variables are a matrix Q ∈ Cm×n^ with orthonormal columns and a triangular matrix R ∈ Cn×n.
  2. (a) Write a Matlab program that sets up a 15 × 40 matrix with entries 0 everywhere except for the values 1 in the positions indicated in the picture below. The upper-leftmost 1 is in position (2,2), and the lower-rightmost 1 is in position (13,39). This picture was produced with the command spy(A).

0 5 10 15 20 25 30 35 40

0

5

10

15

(b) Call svd to compute the singular values of A, and print the results. Plot these numbers using both plot and semilogy. What is the mathematically exact rank of A? How does this show up in the computed singular values? (c) For each i from 1 to rank(A), construct the rank-i matrix B that is the best approximation to A in the 2-norm. Use the command pcolor(B) with colormap(gray) to create images of these various approximations.

  1. (a) Write a Matlab function [W,R] = house(A) that computes an implicit representation of a full QR factorization A = QR of an m × n matrix A with m ≥ n using Householder reflections. The output variables are a lower-triangular matrix W ∈ Cm×n^ whose columns are the vectors vk defining the successive Householder reflections, and a triangular matrix R ∈ Cn×n. (b) Write a Matlab function Q = formQ(W) that takes the matrix W produced by house as input and generates a corresponding m × m orthogonal matrix Q.
  2. Let Z be the matrix

Z =

Compute the reduced QR factorization of Z in Matlab: by the Gram-Schmidt routine mgs of Problem 1, by the Householder routines house and formQ of the previous problem, and by Matlab’s built-in command [Q,R] = qr(Z,0). Compare these three and comment on any differences you see.