Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

DSA2102 Essential Data Analytics Tools: Numerical Computation

Midterm Exam
Semester 2 (2022 – 2023)
Time allowed: 1 hour 20 minutes

INSTRUCTIONS TO CANDIDATES
1. Use A4 size paper and pen (blue or black ink) to write your answers.
2. Write down your student number and your name clearly on the top left of every page of the answers.
3. Write on one side of the paper only. Write the question number and page number on the top right corner of each page (e.g.
Q1P1, Q1P2, ..., Q2P1, ...).
4. Write your answers clearly. Illegible answers will be marked incorrect.
5. This examination paper contains FOUR (4) questions and comprises TWO (2) pages (including this cover page). Answer
ALL questions.
6. The total mark for this paper is FIFTY (50).
7. This is an CLOSED BOOK examination.
8. You may use a NON-PROGRAMMABLE calculator. However, you should lay out systematically the various steps in the
calculations.
9. At the end of the exam,
• scan or take pictures of your work (make sure the images can be read clearly);
• if possible, merge all your images into one pdf file (arrange them in the order from Q1 to Q4 in their page sequence);
• name the pdf file by MatricNo_DSA2102 (e.g. A123456R_DSA2102);
• upload your pdf into the Canvas assignment “Midterm Test”.
Q1 [8 Marks] Determine whether the statements below are true or false. You do not need to explain your answers.
(a) If two real numbers are exactly representable as floating point numbers, then the result of a real arithmetic operation
(+,-,*,/) between them will also be exactly representable as a floating point number.
(b) Floating point addition is associative but not commutative.
(c) For a symmetric matrix A, it is always the case that ∥A∥1 = ∥A∥∞ .
(d) If a matrix has a zero entry on its main diagonal, then it is necessarily singular.
(e) The multipliers in Gaussian elimination with partial pivoting are bounded by 1 in magnitude.
(f) A linear least squares problem always has a solution.
(g) The product of two orthogonal matrices (assuming the dimensions are compatible) is orthogonal.
(h) In exact real arithmetic, the Classical Gram-Schmidt and Modified Gram-Schmidt algorithms produce the same result.
Q2 [10 Marks] Consider the half-precision floating-point format, which has five bits for the exponent and ten bits for the signifi-
cand.

(a) What is the largest positive representable number in this system? Give your answer in both binary and decimal.
(b) What is the smallest positive normal number in this system? Give your answer in both binary and decimal.
(c) What is the smallest positive subnormal number in this system? Give your answer in both binary and decimal.
(d) What is the result of adding the largest positive representable number and the smallest positive normal number? Give
your answer in both binary and decimal.
(e) What is the result of multiplying the largest positive representable number and the smallest positive normal number?
Give your answer in both binary and decimal.
Q3 [20 Marks] Consider the matrix  
4 −4 4 4
 −4 5 −5 −2 
A= 
 4 −5 9 −4 
4 −2 −4 18
(a) Compute the LU factorization of A.
(b) Compute the Cholesky factorization of A.
(c) Compute the QR factorization of A.
(d) What are the relative advantages and disadvantages (e.g., time complexity, stability) of using the three methods above
(LU factorization, Cholesky factorization, QR factorization) to solve an n × n system of linear equations Ax = b?
Q4 [12 Marks] Consider the data

x y
-2 2
-1 1
2 4
3 7

(a) Find the least squares solution the system


   
1 −2   2
 1 −1  x1
 1 

 1
 = 
2  x2  4 
1 3 7

(b) Find the least squares solution to the system


   
1 −2 4   2
 1 −1 1  x1
 1 

 1
 = 
2 4  x2  4 
1 3 9 7

(c) In the data science context, what is the interpretation of the solutions to these two problems?

You might also like