Winter 2016
Assignment 1 (DRAFT)
Due: February 8, 2016 in lab.
Include all written answers, tables, graphs, images and MATLAB code for each problem. Send a separate
.m file for each question where you are requested to do so. Also remember to send along any auxiliary .m
files that are necessary to run your code. I should be able to run your code without any modifications so as
to get the same results you include with this assignment. Make sure that the code you submit is your own.
1. In this problem we endeavour to establish the limits on the size (n × n) of systems of equations that
we may reasonably solve. When the questions below ask about your computer they refer to one of the
computers available to you in the computer labs at Ryerson. You may develop the programs necessary
to test and prove your assertions on any computer you like, but the final results should be about one
of the lab computers.
In answering the questions below, please justify your answers as necessary and make convincing arguments
for your conclusions. Imagine that the person reading your answer is somebody that wishes to
solve large systems of equations on your computer.
(a) In which lab was your computer located?
(b) What is the largest square matrix that you can create on your computer with Matlab?
(c) How long does it take for you to solve a (dense) 100 × 100, 1000 × 1000, 10, 000 × 10, 000, system
of equations (in seconds)?
(d) If your computer had sufficient memory, predict how long it would take to solve a 100, 000×100, 000
system of equations.
(e) Given enough memory estimate what is the largest n × n system you could solve in 24 hours.
2. For a given positive integer n we write a Matlab function to calculate the n
2 × n
2 discrete Laplacian
matrix (see page 565 of the text for details).
(a) Write a Matlab function whose prototype is L = discreteLaplacian(n), where n determines the
size (n
2 × n
2
) of the discrete Laplacian matrix L. For example, if n = 3 then
L =
?
?????????????
4 -1 0 -1 0 0 0 0 0
-1 4 -1 0 -1 0 0 0 0
0 -1 4 0 0 -1 0 0 0
-1 0 0 4 -1 0 -1 0 0
0 -1 0 -1 4 -1 0 -1 0
0 0 -1 0 -1 4 0 0 0
0 0 0 -1 0 0 4 -1 0
0 0 0 0 -1 0 -1 4 -1
0 0 0 0 0 -1 0 -1 4
?
?????????????
Please submit your file discreteLaplacian.m as part of your assignment.
(b) Discuss the complexity of solving LX = B in terms of the variable N = n
2
. Is the complexity
O (N3
), O (N2
), O (N) or something else? How do you reach your conclusions. Do so in both
practical and theoretical terms.
(c) For a given n how much memory does the matrix L consume in general? How much memory is
needed using the sparse command? Support your answer.
3.