linear-algebra¶
About¶
This project builds on SymPy's Matrix class and is designed for students taking NUS MA1522 Linear Algebra for Computing. It has implementations of most of the algorithms taught during the course (as of Sem 1 AY24/25).
Key Features¶
- Import matrices directly from \(\rm\LaTeX\) or string/list representations.
- Step-by-step workings for most algorithms (including LU Factorisation, SVD, QR, diagonalization, and more).
- Enhanced symbolic matrix class with:
- Matrix creation from lists, \(\rm\LaTeX\), or random values.
- Matrix decompositions: REF, RREF, LU, QR, SVD, diagonalization.
- Vector space operations: orthogonalization, projections, basis manipulation, subspace intersection, and more.
- Eigenvalue/eigenvector computations and characteristic polynomials.
- Custom pretty-printing and \(\rm\LaTeX\) formatting, including augmented matrices.
- Support for both exact symbolic and numerical computations.
- Utilities for displaying results in Jupyter/IPython or standard Python.
- Follows MA1522 syllabus conventions for linear algebra and provides detailed, educational output.
- Rich set of custom types for representing decompositions, solutions, and factorizations.
Installation and Usage¶
Installation¶
Prerequisites¶
This project is best supported in a Jupyter Notebook environment with Python 3.10+. You can download Python from here.
Alternatively, you can use a minimal GUI developed by @MarcusMa06-code here.
Install Dependencies¶
It is recommended to use a virtual environment for managing dependencies.
-
Create a virtual environment:
Bash -
Activate the virtual environment:
- On Windows:
Bash - On macOS/Linux:
Bash
- On Windows:
-
Install the library:
It is recommended to use a Jupyter Notebook environment to run the code.Bash Bash
Usage¶
Create a Jupyter Notebook test.ipynb. Within the notebook, run the following code.
Documentation of more functions can be found here.
More usage examples can be found under tutorials.
Live demonstration of the library can be found here.
Offline Documentation¶
An offline version of the documentation is available for download from the Releases page. This is useful for exam when you may not have internet access.
To use the offline documentation:
- Download
linear-algebra-docs-offline.zipfrom the latest release - Extract the ZIP to a folder
- Open
index.htmlin your browser
Building from Source¶
If the offline ZIP is not available in the releases, you can build it yourself:
-
Clone the repository:
-
Install documentation dependencies:
Bash -
Build the documentation:
Bash -
The documentation will be in the
site/folder. Opensite/index.htmlin your browser.
Credits¶
I would like to thank @DenseLance for his contributions.