A = np.array([[0.6, 0.1], [0.5, 0.8]])
Lambda, Q = np.linalg.eig(A)
print(Lambda)
print(Q)[0.45505103+0.j 0.94494897+0.j]
[[-0.56786837+0.j -0.27843404+0.j]
[ 0.82311938+0.j -0.96045535+0.j]]
In float8 (E4M3) the machine epsilon is \(\epsilon_{\mathrm{mach}} = 0.125\). Let
\[ x = 1.0, \qquad e = 0.0625. \]
What is \(x + e\) when computed in float8, and when computed in float16?
An invertible \(N \times N\) matrix \(A\) has already been factored as \(A = PLU\). What is the cost of solving \(Ax = b\) for one new right-hand side \(b\)?
A is an invertible \(N \times N\) matrix and bs is a list of \(K\) right-hand sides.
lu, piv = scipy.linalg.lu_factor(A)
for b in bs:
x = scipy.linalg.lu_solve((lu, piv), b)Compared with calling np.linalg.solve(A, b) inside the loop, which statement is correct?
solve refactors at \(O(N^3)\) on every iteration.lu_factor is only a stylistic choice.np.linalg.solve is cheaper because it never forms \(L\) and \(U\).Let \(Q\) be an orthogonal matrix and \(x\) a vector with \(\lVert x \rVert_2 = 5\). What is \(\lVert Q x \rVert_2\)?
Explain your answer to question 4 more generally: for any orthogonal \(Q\) and any \(x\), what is \(\lVert Q x \rVert_2\)? Give the intuition, and state and prove any general claims you can.
Consider \(x_{t+1} = A x_t\) with
\[ A = \begin{bmatrix} 0.6 & 0.1 \\ 0.5 & 0.8 \end{bmatrix} \]
and an arbitrary \(x_0 \in \mathbb{R}^2\). And note the following.
A = np.array([[0.6, 0.1], [0.5, 0.8]])
Lambda, Q = np.linalg.eig(A)
print(Lambda)
print(Q)[0.45505103+0.j 0.94494897+0.j]
[[-0.56786837+0.j -0.27843404+0.j]
[ 0.82311938+0.j -0.96045535+0.j]]
Which statement is correct?
Explain your answer to question 6.
A = np.array([[0.5, 0.2], [0.1, 0.8]])
print(A ** 2)
print(A @ A)
print(np.linalg.matrix_power(A, 2))[[0.25 0.04]
[0.01 0.64]]
[[0.27 0.26]
[0.13 0.66]]
[[0.27 0.26]
[0.13 0.66]]
Which of the three printed matrices equal \(A^2 = A A\)?
A = np.array([[0.6, 0.1], [0.5, 0.8]])
Lambda, Q = np.linalg.eig(A)
print(np.max(np.abs(Lambda)) < 1)
v = Q[:, 1]
print(np.allclose(A @ v, Lambda[1] * v))Which statement is correct?
v is an eigenvector of \(A\) with eigenvalue Lambda[1], so both lines print True.v is an eigenvector of \(A\).v collects the second entry of each eigenvector, so the second line prints False.True, but abs is unnecessary because the eigenvalues of a real matrix are real.The figure shows \(\lVert x_t \rVert_2\) for \(x_{t+1} = A x_t\) from the same \(x_0\) under three different matrices.

Which matrix has spectral radius greater than \(1\)?
Explain your answer to question 10.
The matrix
\[ A = \begin{bmatrix} 0.9 & 0.3 \\ 0.3 & 0.9 \end{bmatrix} \]
has eigenvalues \(1.2\) and \(0.6\). For which of these discount factors does \(\sum_{s=0}^{\infty} \beta^s A^s\) converge?
Explain your answer to question 12.
A is an \(n \times n\) matrix, d is a vector of length \(n\), and \(0 < \beta < 1\).
pv = np.linalg.solve(np.eye(n) - beta * A, d)Which infinite sum does pv equal, and what condition makes that sum converge?
Two employment models have the same steady-state shares. Their transition matrices have eigenvalues
\[ A_1: \quad 1,\ 0.9, \qquad A_2: \quad 1,\ 0.4. \]
Which model’s deviations from its steady state decay faster?
A = np.array([[1, 2], [2, 1]])
x = np.array([1, 1])
print(x.T @ A @ x)6
Is \(A\) positive definite?
A symmetric matrix \(A\) has the reported eigenvalues
\[ \left[-10^{-17},\ 0.5,\ 1.1\right], \]
computed in float64. How would you categorize \(A\) in terms of positive (semi-)definite, negative definite, or indefinite? Explain.
X = np.array([[1, 2, 3], [0, 5, 7]])
y = np.array([5, 10])
beta_hat, *_ = scipy.linalg.lstsq(X, y)
print(np.allclose(X @ beta_hat, y))True
Is beta_hat the unique solution to \(\min_{\beta} \lVert y - X \beta \rVert_2^2\)? If \(\beta\) were regression coefficients, how would you interpret them given your answer? Explain.