Spectral Harmonograph

Spectral Harmonographs

5th October 2015

This Python + Pygame program draws the trace of 4 decaying sine waves, 2 per axis, with rainbow colours. It generates a sequence of random harmonographs. A harmonograph is a mechanical device typically seen in science museums, that has two or more pendulae with attached pens, that can draw on a sheet of paper. The pendulae are […]

Tower of Hanoi

Animated Tower of Hanoi

3rd July 2015

The Tower of Hanoi is a classic problem that lends itself well to a recursive solution. The story involves some poor monks having to move 64 disks of different sizes (with central holes for the pegs) from one peg to another. There are three pegs, all the disks started on the first peg (in size […]

Drawing Fractals with Lindenmayer Systems

17th June 2015

Lindenmayer systems, or L-systems, provide a very powerful way to construct fractals. Lindenmayer used L-systems to describe the behaviour of plant cells and to model the growth processes of plant development. An L-system is a rewriting system and a type of formal grammar. It consists of an alphabet of symbols that can be used to make […]

Extensible Harmonographs

Extensible Harmonograph

18th May 2015

Often seen in science museums, the harmonograph is a device that combines wave motions (e.g. from some pendulums) to move a pen resting on a sheet of paper. These movements result in attractive patterns. This device can be simulated easily in a computer program such as the following one. The principle is that the wavy […]

Make ‘Computer Music’ with a very small program!

11th May 2015

This is a fun little program to generate ‘computer music’, specifically ‘bytebeats’ which sound like the chip music featured in the early computer games. As is well-known, sound can be digitised and stored in computers. Conversely, numbers can be converted to sound. But those numbers don’t have to come from a file, they can be generated on the […]

Fractal Tree

17th April 2015

This program draws a ‘tree’ by drawing a trunk (initially; later it’s a branch) and appending a tree, recursively. Uses Pillow.