Perfectly random sampling (2): Wilson's uniform spanning tree algorithm

Example:

Requiremens: python>=2.7 and tqdm for showing process bar.

Usage

Run any of the example*.py scripts and wait for a few seconds, you will see a .gif file generated in current directory, enjoy it!

This program is written in pure python: no third-party modules nor softwares are needed, just built-in modules like struct, random, colorsys and some built-in functions (if you want to embed the animation into a background image then PIL is required). It can make animations of all kinds of maze generation and maze solving algorithms on the 2D grid. It runs very fast and generates optimized GIF files in only a few seconds. I could write it faster by using numpy arrays but I prefer to keep the code being "pure blooded".

Update: I have added the process bar feature in the latest version for which the tqdm lib is required.

Icosahedral kaleidoscope

Example:

Requirements: numpy and matplotlib.

The modular group

Example:

Requirements: cairocffi.

This program draws the hyperbolic tiling of the upper plane by fundamental domains of the modular group.

The E8 pattern

Example:

Requirements: cairocffi.

This program draws the figure of the exceptional root system $E_8$ projected to its Coxeter plane. The math involved here may be too complex for non-mathematicians, so I just give a brief sketch of the above image.

Rendering fractals with numpy and numba

Example:

Requirements: numpy, matplotlib and numba.