A blog of Python-related topics and code.

Maze Generation by Cellular Automaton

Cellular automata (CA) can be used to generate mazes, as described on the LifeWiki. A commonly used algorithm operates like John Conway's Game of Life in that a cell is born if it has exactly 3 neighbours but the survival rule is more liberal: a cell survives if it has 1–5 neighbours (rulestring B3/S12345).

Fireball statistics

In astronomy, a fireball is a meteor bright enough to be seen over a wide area (either apparent magnitude greater than -4 or greater than -3 at zenith, depending on the definition used). The terms bolide and, for exceptionally bright meteors, superbolide are also used. A famous recent example is the Chelyabinsk meteor.

Muller's Recurrence

The recurrence devised by Jean-Michel Muller[1] and described in a slightly modified form by William Kahan in a 2006 monograph[2] provides an interesting example of how the finite precision of floating point arithmetic can lead to wildly incorrect results in some circumstances.


A superellipse (also called a Lamé curve) is the curve described by the equation $$ \left|\frac{x}{a}\right|^p + \left|\frac{y}{b}\right|^p = 1 $$ For $n=2$, this is the equation of an ordinary ellipse and for $a=b=1$ that ellipse is a circle. The corresponding curve for $p=4$ is sometimes called a squircle.

Cobweb plots

A cobweb plot is often used to visulaize the behaviour of an iterated function. That is, the sequence of values obtained from setting $x_{n+1} = f(x_n)$, starting at some value $x_0$.