Edit or run this notebook

Midterm

You may use whatever reading materials you want – the course notes should be sufficient, but you may also look online or at books. Make sure you cite any sources beyond the course notes. For this exam, you may ask questions of the course staff, but you should not work with others, whether inside or outside the class.

212 μs
273 μs

1: Efficient operations (5 points)

Rewrite each expression to have the indicated complexity.

163 μs
p1d (generic function with 1 method)
1.2 ms

2: Floating point fiddling (5 points)

Rewrite each expression or better floating point error.

168 μs
p2c (generic function with 1 method)
684 μs

3: Normwise nonsense (5 points)

  1. (1 point) Argue that Ax(maxij|aij|)x1.

  2. (2 points) If PA=LU is computed using the usual partial pivoting strategy, argue that A1nU1.

  3. (2 points) The matrix exponential can be defined formally as exp(A)=k=01k!Ak. Argue that for any operator norm, exp(A)exp(A).

1.5 ms

4: Delightful derivatives (4 points)

Let ARm×n be well conditioned with m>n, and consider x(s)=(A+sE)b for some given ERm×n. Complete the following code for computing x(0) and dx(0)/ds (you may use the normal equations approach).

196 μs
deriv_ls (generic function with 1 method)
710 μs
check_deriv_ls (generic function with 1 method)
711 μs
Inf
102 μs

5: Extending Cholesky (3 points)

Consider the block matrix

M=[AbbTd]

Complete the following code to extend a Cholesky factorization A=RTR to a Cholesky factor of M. Your code should take O(n2) time where ARn×n

200 μs
extend_cholesky (generic function with 1 method)
384 μs

You may use the following code to sanity check your solution.

128 μs
test_extend_cholesky (generic function with 1 method)
686 μs
5.581511538241275e-17
147 ms

6: Least squares limbo (5 points)

Consider the least squares problem of minimizing

ϕ(x,y)=Ax+Byd2

and suppose you are given a code solveAls such that solveAls(d) computes Ad. In this problem, we will solve the least squares problem for x and y using this solver as a building block.

  1. (1 point) Write the normal equations for the least squares problem as a block 2-by-2 system.

  2. (1 point) Do block Gaussian elimination to write a Schur complement system that can be solved for y

  3. (1 point) Rewrite the Schur complement system so that A is not used directly – only use the combinations ATB and A appear (and anything involving B on its own is fine).

  4. (2 points) Complete the following Julia code to solve the least squares problem.

441 μs
solveABls (generic function with 1 method)
330 μs

You may use the following test to sanity check your solution.

119 μs
test_solveABls (generic function with 1 method)
900 μs
1.0249950910118462
51.2 μs

7: Your turn

  1. (1 point) Share one thing in the class you think is working well.

  2. (1 point) Share one thing you think could work better (concrete recommendations are great!).

  3. (1 point) What do you consider the most difficult concept from the first part of the course?

274 μs
Loading...
ii