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 […]

Guess my number?

Number guessing game

1st October 2015

The number guessing game incorporates several simple but important elements of elementary programming and is a good candidate for an introductory programming example. If you’ve seen any programming course, you’ve probably seen the “Hello World” program. In Python it’s: print (“Hello World”)This is done to get the student(s) quickly to the point of having successfully installed […]

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 […]

A Graphical Dice Simulator

31st May 2015

This PyGame program simulates the roll of a die (or dice if you prefer). It’s a fairly simple, straightforward thing to do, though it may be worth noting that the spots display is oh-so-slightly clever. Some spots appear in more than one number, e.g. the middle spot is in all the odd numbers, hence the […]

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 […]


Dr. Turing’s Automatic Machine

14th May 2015

Alan Turing published a ground-breaking paper in 1936, On computable numbers, with an application to the Entscheidungsproblem (PDF). It was about an esoteric problem in mathematics, for which he needed a theoretical model of how a mathematician computes with pencil & paper. He called this model an automatic machine; we now call it a Turing Machine, which […]