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.

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!

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

- Harmonograph by Paul Bourke
- Harmonographs by me at FractalArt.Gallery

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 pantograph, is based on the relative motion of two rotating disks, as illustrated in the links below.

%d bloggers like this: