Mathematician Peter Maurer made public the simple
algorithm that is used to produce these pictures. (Ref.
The American Mathematical Monthly, Volume 94,pp631-645.)
For obvious reasons the algorithm referred to is known as
Here, in terms that can easily be transcribed
to any standard computer language, is what you have to do
to produce such pictures on your own computer.
The program uses whole number variables N, D and
A, and real number varibles X, R, oldX, oldY, newX, newY.
At the start of the program, set the variables N
and D equal to two whole numbers between 1 and 359
(inclusive), and set A, oldX, and oldY equal to zero.
Now you set up a loop consisting of the
1. SetA equal to A+D. If A>360 replace A by the
remainder obtained when you divide A by 360 (that is
compute A mod 360 and set A equal to the result).
2. Calculate N*A, then reduce it mod 360(i.e.
take the remainder on dividing N*A by 360), convert the
result from degrees to radians, and set X equal to the
final result. (To convert from degrees to radians,
multiply by 0.01745.)
3. Set R equal to the sine of X.
4. Convert A from degrees to radians, and set T
equal to the result.
5. Set newX equal to R*sin(T) and set newY equal
to R*cos(T). (This converts the polar coordinates (R,T)
to rectangular coordinates (newX,newY).)
6. Draw a line from the point(oldX,oldY) to
7. If A is equal to zero, then stop, else set
oldX equal to newX, oldY equal to newY, and go back to
The only input the program requires are values
for the two integer variables N and D. Different choices
of these two numbers produce often strikingly different
patterns. For some choices the pattern turns out to be
fairly rudimentary, sometimes just a single dot. For
other values you will obtain pictures every bit as
attractive as these:
Enter N=4, D=43 or N=5, D=97.
They may not smell as sweet, but the roses you
produce on your computer screen can bring every bit as
much pleasure as the real thing.
p.s. Keith Devlin is a professor of mathematics.
He formerly worked in this country but now lives in the
Margaret Wright. K3X