Math 5334: Homework 2 Solutions
Note: The material you hand in should be legible (either typed or neatly
hand-written),
well-organized and easy to mark, including the use of good English. All computer
programs
should be handed in and should be well commented. In general, short, simple
answers are
worth more than long, complicated ones. Unless stated otherwise, all answers
should be
justified.
1. The following exercises from Chapter 2 in the text are to be done by hand.
(a) Question 2.61 on page 95.
(b) Question 2.65 on page 96.
(c) Question 2.4 on page 97.
(d) Question 2.7 on page 97.
(e) Question 2.12 on page 97.
(f) Question 2.17 on page 97.
(g) Question 2.21 on page 98.
2. The following computer problems are to be done using Matlab or Octave. For
each
question, hand in your program code and a transcript of a terminal session
demonstrating
that your programs work correctly. Be sure to indicate clearly which questions
the programs and the transcripts refer to.
(a) (10 points total) Question 2.2 on page 100 (3 points for part a, 2
for b, 5 for
c). You should use the Matlab function lu to compute the LU factorization of
matrix A, and then use the Matlab backslash operator, \, to solve the resulting
triangular systems . (For more details, see "LU Factorization" in the Mathematics
section of the Matlab help pages.)
(b) Question 2.3 on page 100.
(c) Do the following:
i. Write a simple program that, given a square matrix , A, computes the elementary
elimination matrices M1, M2 and M3. You do not need to worry about
the efficiency of this program. Just keep it simple .
ii. Test your program on a random 4*4 matrix, A1, and on a random
8*8
matrix, A2. You can use the Matlab function rand to generate a random
matrix.
iii. For both matrices A1 and A2,
use matrix multiplication to compute the products
M1M2M3 and M3M2M1.
Compare the products to the individual matrices M1, M2 and M3.
iv. For both matrices A1 and A2, use standard matrix
operations to compute
(M3M2M1)-1. Compare the results to the individual
matrices M1, M2 and
M3. You should use the Matlab function inv to compute the inverse.
v. Write a faster program to compute (M3M2M1)-1.
Verify that your program
gives the same results as in part iv.
vi. Generate random n*n matrices for n = 10, 100, 1000,
2000, 3000, 4000, 5000.
Use the Matlab functions tic and toc to measure how much time your pro-
gram in part v takes to execute on each of these matrices. Also measure the
amount of time used by the more-straightforward method in part iv. (If your
computer cannot handle the larger matrices, don't worry about it.)
No more questions will be added
Prev | Next |