Math 6800 Problem Set 3: Computing Reduced QR Factorization and Solving Linear Systems - P, Assignments of Linear Algebra

Problem set 3 for math 6800, a university-level mathematics course. The problem set includes instructions for writing computer subroutines to compute the reduced qr factorization of a real matrix using the modified gram-schmidt algorithm, and to find the least squares solution of a linear system using householder triangulation. The problem set also includes instructions for testing these subroutines using vandermonde matrices and different sets of nodes.

Typology: Assignments

2011/2012

Uploaded on 02/17/2012

koofers-user-rwz-1
koofers-user-rwz-1 🇺🇸

10 documents

1 / 13

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Math 6800
D. Schwendeman Problem Set 3
Due:
Thursday, 9/30/10
1. (a) Write a computer subroutine (or Matlab function) that computes the reduced QR-
factorization of an m×nreal matrix Ausing the modified Gram-Schmidt algorithm. Your
code may assume that mnand should check for rank deficiency of Ain a sensible way
(and return an error message if such a case occurs).
(b) Test your code using the m×nVandermonde matrix
A=
1t1t2
1· · · tn1
1
1t2t2
2· · · tn1
2
.
.
..
.
..
.
..
.
.
1tmt2
m· · · tn1
m
where the nodes ti,i= 1,2, . . . , m, are distinct (so that Ahas full rank). Consider the case
when m= 21, n= 6 and ti= (i11)/10 which are equally spaced nodes on [1,1]. Check
that kˆ
Qˆ
RAkand kˆ
QTˆ
QIkare both small, and print out these values.
(c) Let p=αqj, where qjis the jth column of ˆ
Qand αis a scalar constant. Choose α
so that the last element pis 1. Plot the data (ti,pi), i= 1, . . . , m, for each column of ˆ
Q
on the same graph. Observe that these curves are approximations of the first six Legendre
polynomials. Explain this observation. (Hint: consider a discrete approximation of the
integral orthogonality for the Legendre polynomials.)
(d) Redo parts (b) and (c) using the Chebyshev nodes ti= cos((2i1)π/(2m)). For this
case, the curves are no longer approximations of Legendre polynomials. What orthogonal
functions do you think they approximate. Explain.
2. (a) Consider the real m×nsystem Ax=b, where mn. Write a subroutine that
computes the QR-factorization of Ausing Householder triangulation. Output the results
of the algorithm compactly in a matrix of size Aas discussed in class. (You might need an
extra row for this compact storage.) Your code should check for rank deficiency and return
an error message as before. Write a second subroutine that computes the solution of the
linear system given the QR-factorization of Aand the right-hand-side vector b. (For the
case m > n, the solution is in a least squares sense.)
(b) Test your code by considering the following curve fitting problem. Find the best fit
polynomial
P(t) = a0+a1t+a2t2+· · · +an1tn1
to the data (ti, yi), i= 1,2, . . . , m. The problem is equivalent to solving Ax=b, where
Ais the Vandermonde matrix above, bi=yi, and xj=aj1. Run your codes for the case
when ti,i= 1,2, . . . , m, are equally spaced nodes on [5,5] and yi= 1/(1 + t2
i). Compute
and plot the polynomial interpolants for m= 21 and n= 3, 7, 15, and 21. (Use many more
nodes than the 21 data points to plot the smooth polynomial interpolants.) Comment on
the accuracy and behavior of the curves.
(c) Repeat part (b) but use the Chebyshev nodes ti= 5 cos((2i1)π/(2m)).
pf3
pf4
pf5
pf8
pf9
pfa
pfd

Partial preview of the text

Download Math 6800 Problem Set 3: Computing Reduced QR Factorization and Solving Linear Systems - P and more Assignments Linear Algebra in PDF only on Docsity!

Math 6800

D. Schwendeman Problem Set 3

Due: Thursday, 9/30/

  1. (a) Write a computer subroutine (or Matlab function) that computes the reduced QR- factorization of an m × n real matrix A using the modified Gram-Schmidt algorithm. Your code may assume that m ≥ n and should check for rank deficiency of A in a sensible way (and return an error message if such a case occurs).

(b) Test your code using the m × n Vandermonde matrix

A =

   

1 t 1 t^21 · · · tn 1 −^1 1 t 2 t^22 · · · tn 2 −^1 .. .

1 tm t^2 m · · · tn m−^1

   

where the nodes ti, i = 1, 2 ,... , m, are distinct (so that A has full rank). Consider the case when m = 21, n = 6 and ti = (i − 11)/10 which are equally spaced nodes on [− 1 , 1]. Check that ‖ Qˆ Rˆ − A‖ and ‖ QˆT^ Qˆ − I‖ are both small, and print out these values.

(c) Let p = αqj , where qj is the jth^ column of Qˆ and α is a scalar constant. Choose α so that the last element p is 1. Plot the data (ti, pi), i = 1,... , m, for each column of Qˆ on the same graph. Observe that these curves are approximations of the first six Legendre polynomials. Explain this observation. (Hint: consider a discrete approximation of the integral orthogonality for the Legendre polynomials.)

(d) Redo parts (b) and (c) using the Chebyshev nodes ti = cos((2i − 1)π/(2m)). For this case, the curves are no longer approximations of Legendre polynomials. What orthogonal functions do you think they approximate. Explain.

  1. (a) Consider the real m × n system Ax = b, where m ≥ n. Write a subroutine that computes the QR-factorization of A using Householder triangulation. Output the results of the algorithm compactly in a matrix of size A as discussed in class. (You might need an extra row for this compact storage.) Your code should check for rank deficiency and return an error message as before. Write a second subroutine that computes the solution of the linear system given the QR-factorization of A and the right-hand-side vector b. (For the case m > n, the solution is in a least squares sense.)

(b) Test your code by considering the following curve fitting problem. Find the best fit polynomial P (t) = a 0 + a 1 t + a 2 t^2 + · · · + an− 1 tn−^1

to the data (ti, yi), i = 1, 2 ,... , m. The problem is equivalent to solving Ax = b, where A is the Vandermonde matrix above, bi = yi, and xj = aj− 1. Run your codes for the case when ti, i = 1, 2 ,... , m, are equally spaced nodes on [− 5 , 5] and yi = 1/(1 + t^2 i ). Compute and plot the polynomial interpolants for m = 21 and n = 3, 7, 15, and 21. (Use many more nodes than the 21 data points to plot the smooth polynomial interpolants.) Comment on the accuracy and behavior of the curves.

(c) Repeat part (b) but use the Chebyshev nodes ti = 5 cos((2i − 1)π/(2m)).