Precept 6: Midterm practice problems

Q1: Remember rootfinding?

Q2: Fast mat-vecs

You may use code from your HW and precepts (and solutions of these) for these problems (same will be true on exam)

$$ A = \qquad\begin{bmatrix} c_0 & r_1 & r_2 & r_3 & r_4 \\ c_1 & c_0 & r_1 & r_2 & r_3 \\ c_2 & c_1 & c_0 & r_1 & r_2 \\ c_3 & c_2 & c_1 & c_0 & r_1 \\ l_0 & l_1 & l_2 & l_3 & l_4 \end{bmatrix} $$

Q3: Transformations

Let $$ x = \begin{bmatrix} x_1\\ x_2\\ \vdots\\ x_k \\ \vdots\\ x_n \end{bmatrix} \qquad \text{ and } \qquad y = \begin{bmatrix} 0\\ \vdots\\ 0\\ x_k \\ x_{k+1} \\ \vdots\\ x_{n} \end{bmatrix} $$ with $x_k \neq 0$. Find $u,v \in \mathbb{R}^n$ such that:

$$ (I - uv^T)x = y $$

and $(I - uv^T)$ is upper triangular.

Q4: Least squares

Consider the least squares: $\min_{x,y} \| A x + By\|_2^2 + \| Cy - d\|_2^2 $ Find the normal equations and do a step of Block Gaussian elimination to find a linear system that $y$ satisfies. That is, find $H$ and $v$ such that $Hy = v$. You may assume A, B, and C all have full column rank.

Implement your solution. You may use np.linalg.solve(F,H) to form matrices of the form $F^{-1} H$, and to solve $Hy =v$