
The plotting capacity of the ZX80(81) enables even the least artistically talented to create some pretty dazzling displays. The much denigrated sine and cosine functions conceal mathematical mysteries that are invisible to mere number crunchers.
Take the hypotrochoid. It is represented by a rather formidable mathematical expression, but it makes a marvellous propellor if displayed on your Sinclair.
x = n cos t + h cos n/b t
y = n sin t – h sin n/b t
In mathematical parlance, this is a parametric formula describing the hypotrochoid. X and Y are the coordinates of the graph which can be produced by means of the PLOT command. “t” is a variable representing the infinite number of angles a radius creates as it sweeps round a circle. “t” plays a part because a hypotrochoid is a line formed by a point fixed to a circle rolling along the inner side of a stationary circle. “n,” “h,” and “b” are parameters that are uniquely defined for each size and shape of hypotrochoid.
Although this description may seem a bit overwhelming to those allergic to mathematics, it translates into very simple programs. Try this:
10 LET T=0
20 LET T=T+.1
30 LET X=12*COS T+8*COS (4*T)
40 LET Y=12*SIN T-8*SIN (4*T)
50 PLOT X+30,Y+20
60 GOTO 20
This routine can be run in either SLOW or FAST mode. Whenever you want to stop the program and admire your handiwork, simply press the BREAK pedal. Beware, it takes a while for this program to cook, especially in the SLOW mode. Through successive iterations the lines are gradually filled in to form a continuous propellor.
The hypotrochoid expresses the elegant simplicity and exquisite symmetry trapped inside many algebraic expressions. Its formula also contains an infinite number of bizarre, fascinating, and sometimes whimsical figures that can be coaxed out by mathematical mutilation. For example, try altering lines 30, 40, and 50 in this fashion.
10 LET T=0
20 LET T=T+.1
30 LET X=12*COS T+4*COS (4*T)
40 LET Y=12*SIN T-8*SIN (4*T)
50 PLOT Y+30,X+20
60 GOTO 20
Surprise. The propellor has metamorphosed into a doll. A more intricate doll, a dancer I think, can be formed by the following alteration:
10 LET T=0
20 LET T=T+.1
30 LET X=12*COS T+6*COS (4*T)
40 LET Y=12*SIN T-8*SIN (9*T)
50 PLOT Y+30,X+20
60 GOTO 20
Note that in the last two examples I have reversed the X and Y plot position in order to rotate the display 90 degrees. I suppose that mathematically speaking, these figures are no longer hypotrochoids, but they are the result of meditations on a hypotrochoid. For something completely different, try this:
10 LET T=0
20 LET T=T+.1
30 LET X=6*COS T+8*COS (4*T+.5)
40 LET Y=12*SIN T-4*SIN (4*T)
50 PLOT Y+30,X+20
60 GOTO 20
I call it the “angry cat.” If you are fond of butterflies, try this galactic variety:
10 LET T=0
20 LET T=T+.1
30 LET X=6*COS T+8*COS (6*T)
40 LET Y=12*SIN T-4*SIN (6*T)
50 PLOT Y+30,X+20
60 GOTO 20
It is quite remarkable how resiliant this framework is. By means of seemingly random alterations, interesting forms emerge. Garbage is possible, but relatively rare. Try your hand and see what you come up with. It is a simple process of artistic experimentation. Be careful, however, not to choose large values for n and h that run the figure off the screen.
If you find this interesting, I highly recommend a book by J. Dennis Lawrence called A Catalog of Special Plane Curves. It is published as a durable paperback by Dover (New York, 1972). In it I discovered the hypotrochoid and its parametric representation. If you get excited by deltoids, hippopedes, rhodonea and nephroids, buy it. You can meditate and discover the inner harmonies of your computer. And, by the way, by drawing amusing and sometimes beautiful computer pictures, you may be able to convince your sceptical spouse or not easily impressed children that computers are not all that bad.
As a parting gesture, I give you “Acquatic Pegasus.”
10 LET T=0
20 LET T=T+.1
30 LET X=12*COS T+6*COS (3*T+2)
40 LET Y=12*SIN T-8*SIN (6*T)
50 PLOT Y+30,X+20
60 GOTO 20
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.