Skip to content

Oval17/visual-math

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Visual Math

A collection of Python scripts that generate mathematical and scientific animation videos using Pillow (PIL) and FFmpeg.

Each script in the make_*.py series produces a standalone visualisation — ranging from fractals and sorting algorithms to physics simulations and number theory — rendered frame-by-frame as a 720×1280 portrait video.

All scripts live under the scripts/ directory.

Getting Started

Prerequisites

  • Python 3.8+
  • FFmpeg (for encoding frames into video)
  • DejaVu fonts (or change FONT_DIR in helpers.py)

Install dependencies

pip install pillow numpy

Run a visualisation

python scripts/make_mandelbrot.py
python scripts/make_sortrace.py
python scripts/make_koch.py

Each script outputs an .mp4 file in the current directory.

Visualisations

Script Topic
scripts/make_mandelbrot.py Mandelbrot set zoom
scripts/make_julia.py Julia set fractal
scripts/make_koch.py Koch snowflake
scripts/make_sierpinski.py Sierpinski triangle
scripts/make_fern.py Barnsley fern
scripts/make_dtree.py Recursive fractal tree
scripts/make_lorenz.py Lorenz attractor (chaos)
scripts/make_diffusion.py Diffusion simulation
scripts/make_dpend.py Double pendulum
scripts/make_3body.py Three-body problem
scripts/make_buffon.py Buffon's needle (Pi estimation)
scripts/make_pi.py Pi visualisation
scripts/make_e.py e visualisation
scripts/make_phi.py Golden ratio visualisation
scripts/make_collatz.py Collatz conjecture tree
scripts/make_ulam.py Ulam spiral (primes)
scripts/make_sieve.py Sieve of Eratosthenes
scripts/make_fib.py Fibonacci spiral
scripts/make_pascal.py Pascal's triangle
scripts/make_riemann.py Riemann sum visualisation
scripts/make_taylor.py Taylor series approximations
scripts/make_basel.py Basel problem (Pi²/6)
scripts/make_leibniz.py Leibniz formula for Pi
scripts/make_galton.py Galton board (normal distribution)
scripts/make_bogo.py Bogosort visualisation
scripts/make_sortrace.py Sorting algorithm race
scripts/make_quicksort.py Quicksort visualisation
scripts/make_mergesort.py Mergesort visualisation
scripts/make_heapsort.py Heapsort visualisation
scripts/make_radix.py Radix sort visualisation
scripts/make_maze.py Maze generation / solving
scripts/make_bezier.py Bézier curves
scripts/make_spirograph.py Spirograph patterns
scripts/make_rose.py Rose curves
scripts/make_polar.py Polar coordinate visualisations
scripts/make_voronoi.py Voronoi diagrams
scripts/make_kmeans.py K-means clustering
scripts/make_pca.py Principal component analysis
scripts/make_linreg.py Linear regression
scripts/make_logreg.py Logistic regression
scripts/make_gd.py Gradient descent
scripts/make_nndb.py Neural network decision boundary
scripts/make_conv.py Convolution visualisation
scripts/make_fourier.py Fourier series
scripts/make_fourier_heart.py Fourier series drawing a heart
scripts/make_fsquare.py Fourier square wave
scripts/make_fstar.py Fourier star shape
scripts/make_fbutterfly.py Fourier butterfly
scripts/make_phyllotaxis.py Phyllotaxis / sunflower spiral
scripts/make_hilbert.py Hilbert curve (space-filling)
scripts/make_tesseract.py 4D tesseract projection
scripts/make_dslit.py Double-slit experiment
scripts/make_pwave.py Wave interference
scripts/make_standing.py Standing waves
scripts/make_cubes.py 3D cube rotation
scripts/make_birthday.py Birthday paradox simulation
scripts/make_pi_collisions.py Pi from elastic collisions
scripts/make_archimedes.py Archimedes' Pi method
scripts/make_newton.py Newton's method visualisation
scripts/make_brach.py Brachistochrone curve
scripts/make_pyth.py Pythagorean theorem visualisation
scripts/make_act.py Activation functions
scripts/make_logistic.py Logistic map (chaos)
scripts/make_rd.py Reaction-diffusion system
scripts/make_maurer.py Maurer rose
scripts/make_megarace.py Mega sorting race
scripts/make_rule30.py Rule 30 cellular automaton
scripts/make_life.py Conway's Game of Life
scripts/make_rwalk.py Random walk

Project structure

├── scripts/
│   ├── helpers.py          # Shared utilities (rendering, encoding, colors, fonts)
│   ├── make_mandelbrot.py  # Mandelbrot set zoom
│   ├── make_sortrace.py    # Sorting algorithm race
│   └── ...                 # 65 more visualisation scripts
├── .gitignore
└── README.md

Output

All videos are rendered at 720 × 1280 pixels, 30 FPS, H.264 encoded.

About

▶ A collection of Python scripts that generate mathematical and scientific animation videos using Pillow and FFmpeg — fractals, sorting algorithms, physics simulations, number theory, ML visualizations, and more.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages