Code Katas and Numerical Fault Experiments
Implement all eight lab contracts, budgeting 20–28 hours across four labs. These are first implementations with explanation and revision, not timed recall drills. Then complete P16–P20.
P16. Sensitivity. Solve A=[[1,1],[1,1.0001]] against b=(2,2) and b'=(2,2.0001) exactly. Compute relative infinity-norm input/output changes and the condition number. Explain what a zero residual can and cannot establish.
P17. Rank cutoff. For diag(1,10^-8), use cutoff 10^-6 times the largest singular value. Compare exact and thresholded pseudoinverse action on (0,10^-8). Why might the discarded direction still matter to a downstream question?
P18. Convergence hypotheses. Let A have diagonal ones and all off-diagonal entries 3/4 in dimension three. Show A is SPD. For b=(1,1,1), trace three Jacobi updates from zero and show why this iteration diverges despite SPD.
P19. Changed objectives. Fit a constant to (1,3) with weights (1,3). Compare the unweighted fit. Separately use A=[[1,1],[2,2]], b=(1,2): describe all ordinary least-squares minimizers, the minimum-norm one, and the ridge solution at lambda=1.
P20. Method decision. Choose and justify a method for a small SPD system, a tall full-column-rank fit, a rank-deficient fit and the graph Laplacian [[1,−1],[−1,1]] with b=(1,−1). Explain the last system's compatibility and gauge. For each, state a checkable output and one assumption whose failure changes your choice.
Inject one defect into a copy: lose a row swap, return reduced column bases, skip QR normalization, accept positive diagonals as PD, claim power convergence at the iteration limit, square the SVD tail norm, or ignore residual scaling. Save a counterexample and explain why the checker catches it.
After your attempt, use the separate feedback.