Extensible Harmonographs

Extensible Harmonograph

By Monty, 18th May 2015

Extensible Harmonograph

Extensible Harmonograph

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 motions are represented by sine waves (one per pendulum). They are effectively Lissajous figures decaying over time.

The attraction of the harmonograph is largely due to the closely spaced, almost parallel wavy lines. There’s 2 contributors to that: the motion decay (due to friction in the real device), and the fuzzy integers make the periodic orbits slightly miss their previous trajectory. Think of the Lissajous figure: when the x y frequencies are integral the trace stays still; change one and the figure starts to rotate.

Extensible Harmonograph

Extensible Harmonograph

The following program is an extensible harmonograph simulator – you can easily change the number of pendulums or the number of dimensions to plot in. Usually harmonographs are drawn using 2 or 3 pendulums in 2 dimensions, but you can add more! Each run plots a random harmonograph, choosing a near-integer number (a fuzzy integer, e.g. 3.004, 6.998) for each frequency. This tends to generate good pictures. Numbers that aren’t near-integer tend to make messy pictures.

The motion of a damped pendulum is x = A * sin (t * f + p) * e-d * t, where A is the  initial amplitude, t is time, f is the frequency, d is a damping factor due to friction, and p is the initial phase (where in the sine wave the pendulum starts). In many implementations the damping factor is given by an exponential decay function, but we’re happy to simply multiply by a number that we scale down slightly per time step. And finally there is a constant scaling factor to fit the motion into the drawing area.

We simplify things by setting all amplitudes to 1, with little loss, if any, of aesthetics. Allowing amplitudes to be small diminishes all the efforts the sine waves go to to bring you pretty patterns!

Program Notes

  1. You need these libraries: turtle, random, colorsys, math. They are already installed with Python.
  2. Some features e.g. colorsys aren’t available in Trinket so they’re commented out and say ‘nit’.
  3. If you want more than 2D you’ll need an appropriate plotting library, e.g. vpython for 3D (but not yet in Python3.
  4. You can select to plot in black on white or colour on black, or edit to choose your own colours.
  5. Parameters: window size, # of pendulums, etc. Play with these to your heart’s content!
  6. fuzzint(mf,sd) returns a random near-integer in the range 1 – mf. sd is the ‘fuzziness’.
  7. Frequencies and phases are computed inside a little Python list of lists magic.
  8. Set up turtle graphics. Click on canvas to exit.
  9. while dec > end: dec is the decay factor, the loop terminates when the motions have decayed…
  10. Compute xy coordinates inside another bit of Python magic. Note that p & q are ‘reversed’: [q][p]
  11. Run & enjoy!

Further Information


A harmonograph is a mechanical apparatus that employs pendulums to create a geometric image. The drawings created typically are Lissajous curves, or related drawings of greater complexity. The devices, which began to appear in the mid-19th century and peaked in popularity in the 1890s, cannot be conclusively attributed to a single person, although Hugh Blackburn, a professor of mathematics at the University of Glasgow, is commonly believed to be the official inventor.

A simple, so-called "lateral" harmonograph uses two pendulums to control the movement of a pen relative to a drawing surface. One pendulum moves the pen back and forth along one axis and the other pendulum moves the drawing surface back and forth along a perpendicular axis. By varying the frequency and phase of the pendulums relative to one another, different patterns are created. Even a simple harmonograph as described can create ellipses, spirals, figure eights and other Lissajous figures.

More complex harmonographs incorporate three or more pendulums or linked pendulums together (for example hanging one pendulum off another), or involve rotary motion in which one or more pendulums is mounted on gimbals to allow movement in any direction.

A particular type of harmonograph, a pintograph, is based on the relative motion of two rotating disks, as illustrated in the links below.

%d bloggers like this: