Skip to main content

linear-algebra-visualizer

An educational Python library for seeing linear algebra as geometry. It uses only NumPy and Matplotlib, so the formulas remain close to the code and work in both scripts and Jupyter notebooks.

Mathematical convention

All vectors are column vectors. A matrix acts on a vector as v_prime = A @ v; therefore A @ B @ v applies B first and A second. Coordinates use the usual Cartesian plane, and rotation(45) means a counterclockwise 45-degree rotation. Set radians=True when supplying radians.

Install

Install the released package from PyPI:

python -m pip install linear-algebra-visualizer

For local development from the source tree:

cd linear-algebra-visualizer
python -m pip install -e ".[dev]"

The runtime dependencies are numpy and matplotlib. Development extras add pytest, jupyter, and ipykernel. ipywidgets is intentionally optional; notebooks use ordinary code cells so the core package remains small.

Quick start

import numpy as np
from laviz import plot_transformation, rotation

T = rotation(45)
plot_transformation(T, vector=np.array([2, 1]))
from laviz import plot_composition, rotation, shear

T1 = rotation(90)
T2 = shear(kx=1)
plot_composition(T1, T2, np.array([1, 2]))

Main API

  • Vectors: plot_vector, plot_vectors, vector_add, vector_subtract, scalar_multiply, magnitude, normalize
  • Geometry: dot_product, plot_dot_product, cross_product, plot_cross_product, project_vector, plot_projection
  • Matrices: matrix_multiply, matrix_vector_multiply, multiplication_steps
  • Transformations: identity, rotation, scale, shear, reflection, transform_vector, compose, plot_transformation, plot_composition
  • Area and inverse: determinant, plot_determinant, inverse, plot_inverse
  • Spectral methods: eigenvalues_eigenvectors, plot_eigenvectors, singular_value_decomposition, plot_svd, principal_components, project_onto_components, plot_pca

Structure

src/laviz contains compact modules organized by concept. tests verifies mathematical identities independently of rendering. notebooks contains twelve progressive lessons: vector operations through PCA.

Development

python -m pytest
jupyter notebook notebooks/

Plots return Matplotlib axes (or a figure and axes for multi-panel diagrams), making them composable. The 2D visualizers are intentionally limited to 2D because that is where grids, determinants, eigenvectors, SVD, and PCA can be inspected directly; cross products use Matplotlib's 3D axes.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

linear_algebra_visualizer-0.1.0.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

linear_algebra_visualizer-0.1.0-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file linear_algebra_visualizer-0.1.0.tar.gz.

File metadata

File hashes

Hashes for linear_algebra_visualizer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8685f4673708b9823a7c174b2fd85b2e70734721f300f2cb76a48668ecf3b451
MD5 e5989fee389ca1724f5a0f8722ca7992
BLAKE2b-256 1606241edcda7d6dc62bfc9d2b60381e6e75d0c0cb19dd08a374267940f7e5eb

See more details on using hashes here.

File details

Details for the file linear_algebra_visualizer-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for linear_algebra_visualizer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8be694c0624c661287ec9df45c7f38078e1288994a99b6fa2936e90d3c223c8c
MD5 3b0974b5a330ca46674aaa8dcf22e29f
BLAKE2b-256 68283e46eeeed3fba98c3a6c855b035c689768043991650ffb40ee624a66a013

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page