Skip to main content

MATH 345: Linear Algebra and Optimization

Appendix E Lab Index

The notebooks are linked supplements to the textbook. They are not meant to be long take-home programming assignments. The main sequence in each lab is designed for in-class use or guided review.
Lab U1: Vectors, Similarity, Attention, and Matrix Actions. Unit 1. Includes optional warm-up and optional extension sections. Focus: read short NumPy snippets as mathematical notation; interpret norms, dot products, cosine similarity, attention-style weighted averages, matrix-vector products, matrix products, geometric matrix actions, and affine maps. Learning outcomes. U1-LO1, U1-LO2, U1-LO3, U1-LO4, U1-LO5, U1-LO6, U1-LO7, U1-LO8.
Lab U2: Understanding a Linear Map. Unit 2. Focus: read short NumPy and SymPy snippets as mathematical notation; interpret reachable outputs, row reduction, plane intersections, homogeneous systems, forgotten directions, rank, null vectors, redundant features, determinants, and inverse checks. Learning outcomes. U2-LO1, U2-LO2, U2-LO3, U2-LO5, U2-LO6, U2-LO7.
Lab U3: Jacobian matrices and local linearization. Unit 3. Focus: Jacobian matrices and local linear prediction. Learning outcomes. U3-LO3, U3-LO5.
Lab U4: Regression as Projection. Unit 4. Focus: design matrices, least squares, residual orthogonality. Learning outcomes. U4-LO4, U4-LO5, U4-LO7.
Lab U5: Hessian eigenvalues, least squares, and fixed nonlinear features. Unit 5. Focus: interpret Hessian eigenvalues as curvature information; connect residual orthogonality, zero gradient, and curvature in least squares; and fit a coefficient vector for fixed nonlinear features. The opening block revisits gradient descent and a final-layer outer-product update from Unit 3. Learning outcomes. U3-LO6, U3-LO9, U5-LO5, U5-LO6, U5-LO7.
Lab U6: Constraints, PCA, and SVD. Unit 6. Focus: read short NumPy snippets as mathematical notation; check one- and several-constraint Lagrange conditions; connect quadratic forms with maximum stretch; center data and form covariance; compute PCA scores, reconstructions, residuals, and principal coordinates; compare PCA with regression; connect PCA with SVD; and read rank and the four fundamental subspaces from an SVD. Learning outcomes. U6-LO2, U6-LO3, U6-LO4, U6-LO5, U6-LO6, U6-LO7.
Lab U7: Polynomial Approximation. Unit 7. Focus: read polynomial feature matrices, least-squares coefficients, fitted values, residual checks, shrinking-interval coefficients, Gram-Schmidt checks, and sampled plane fits. Compare Taylor, continuous least-squares, and sampled least-squares approximations. Learning outcomes. U7-LO3, U7-LO4, U7-LO5, U7-LO6.
Transformer Wrap-Up Lab: A Tiny Attention Block. Appendix: Transformer Wrap-Up Worksheet. Status: optional extension. Focus: token matrices, attention scores, masks, weighted values, logits, and one small loss. Learning outcomes. U1-LO3, U1-LO6, U1-LO8, U3-LO7, U3-LO8.