Skip to content

Latest commit

 

History

35 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Applied Linear Algebra Labs

Hands-on Jupyter and Python notebooks that teach applied linear algebra through real projects: image compression with SVD, PCA on MNIST, Google's PageRank algorithm, spectral clustering, quantum computing basics, word embeddings, and more. Useful for anyone learning linear algebra by writing code.

Each lab ships in one or more versions (v1 through v7). Later versions cover the same core ideas from a different angle or add new topics, so you can work through several versions of the same lab without repeating yourself.

Table of contents

Lab 1: NumPy fundamentals, 3D graphics, and cryptography

Version Topics Notebook
v1 NumPy arrays, array arithmetic, slicing, Gaussian elimination, interpolation, color grading Lab#01-Introduction.ipynb
v2 NumPy, color grading, linear transformations, 3D polygon rendering with orthogonal matrices Lab#01-V2-Introduction.ipynb
v3 NumPy, Gaussian elimination, polynomial interpolation, Hill cipher encryption and decryption, known plaintext attack on the Hill cipher Lab#-1-V3-Introduction.ipynb
v4 NumPy, linear systems, image processing with color channel operations, 2D and 3D geometric transformations (scaling, rotation, shearing, translation) FUM-Linear-Algebra-lab#01.ipynb

Lab 2: Least squares, regression, and quantum computing

Version Topics Notebook
v1 Projection matrices and least squares, solving least squares via QR decomposition with modified Gram-Schmidt, medical cost prediction with linear regression Lab#02-Least-Mean-Squares.ipynb
v2 Least squares and QR decomposition, car price prediction, polynomial regression Lab#02-V2-Least-Mean-Squares.ipynb
v3 Quantum computing foundations: qubits, superposition and measurement probabilities, basis changes and Gram-Schmidt orthonormalization, quantum gates as matrices, BB84 quantum key distribution FUM-Linear-Algebra-lab#02.ipynb

Lab 3: SVD, PCA, PageRank, and spectral methods

Version Topics Notebook
v1 Image compression with singular value decomposition (SVD), video background subtraction Lab#03-SVD.ipynb
v2 SVD image compression, eigenfaces and face reconstruction on the Labeled Faces in the Wild dataset Lab#03-V2-SVD-PCA.ipynb
v3 Encoding data as matrices, SVD, principal component analysis (PCA), dimensionality reduction on MNIST Lab#03-v3-SVD-PCA.ipynb
v4 Determinants, Cramer's rule, eigenvectors via power iteration, and Google's PageRank algorithm for ranking web pages by link structure FUM_Linear_Algebra_lab_#03.ipynb
v5 Spectral clustering: grouping data based on pairwise similarities and graph structure FUM_Linear_Algebra_lab_#03-Spectral.ipynb
v6 Spectral data selection for identifying informative samples within training batches FUM_Linear_Algebra_lab_#03.ipynb
v7 Leverage scores and SVD-based dimensionality reduction for anomaly detection in industrial images FUM_Linear_Algebra_lab_#03.ipynb

Example: Background subtraction with SVD (from v1): original clip minus its low-rank approximation leaves the moving foreground.

|| - | = |

Lab 4: Natural language processing with SVD

Version Topics Notebook
v1 Implementing SVD, text data loading and preprocessing, vocabulary construction, word embeddings via singular value decomposition linalg_proj4.ipynb

Running the notebooks

Install uv and set up the project and install the dependencies:

uv init
uv add numpy matplotlib pandas scikit-learn jupyterlab

Then clone and launch:

git clone https://github.com/arashsm79/applied-linear-algebra-lab.git
cd applied-linear-algebra-lab
uv run jupyter lab

Contributing

Contributions are welcome. Open an issue if you spot a mistake in a notebook, or send a pull request with a fix or a new lab topic.

License

Distributed under the MIT License.