**epicycloid**,
a Python code which
plots an epicycloid curve.

An epicycloid is the curve traced by a point on the perimeter of a circle of radius r1 which is rolling around the perimeter of a a circle of radius r2. Normally, r1 is smaller than r2.

The equations for the (x,y) coordinates of the point are:

x(t) = (r1+r2) * cos(t) - r1 * cos ( (r1+r2)*t/r1 ) y(t) = (r1+r2) * sin(t) - r1 * sin ( (r1+r2)*t/r2 )It is usual to write k = r2/r1. If k is an integer, then the curve is closed, and has k cusps. If k is rational, and in lowest terms is p/q, then it has p cusps. Otherwise, if k is irrational, then mathematically the curve is not closed, and fills the annulus of radiuses r2 and r2+r1.

To use the programs, you specify:

- k, the ratio r2/r1,
- s, the number of times the small circle should roll around the big one
- n, the number of points to compute.

The computer code and data files made available on this web page are distributed under the MIT license

**epicycloid** is available in
a MATLAB version and
an Octave version and
a Python version.

caustic, a Python code which generates an image of a caustic, by drawing n equally spaced points in a circle, and then connecting specific pairs of points using a spacing parameter m.

fern, a Python code which displays the Barnsley fractal fern.

fibonacci_spiral, a Python code which displays points on a Fibonacci spiral, suggesting the arrangement of seeds in a sunflower, for instance.

hilbert_curve, a Python code which computes the sequence of discrete Hilbert curves whose limit is a space-filling curve.

mandelbrot, a Python code which generates an image of the Mandelbrot fractal set;

- epicycloid.py, the source code;
- epicycloid.sh, runs all the tests;
- epicycloid.txt, the output file.

- epicycloid.png, a plot of an epicycloid.