# Using equations to draw out complex objects

How do people come up with equations of curves to draw out complex objects?

Some popular examples would include: batman curve & PSY curve.

This stackexchange link explains the rationale for the batman curve nicely.

But other than trial and error, I can't see a reasonable way of drawing the much more complicated PSY curve.

An extremely detailed explanation is given in the post "Making Formulas… for Everything—From Pi to the Pink Panther to Sir Isaac Newton " by Michael Trott on the Wolfram Blog. A brief excerpt:

Assume you make a line drawing with a pencil on a piece of paper, and assume you draw only lines; no shading and no filling is done. Then the drawing is made from a set of curve segments. The mathematical concept of Fourier series allows us to write down a finite mathematical formula for each of these line segments that is as close as wanted to a drawn curve.

...

We want a single formula for the whole equation, even if the formula is made from disjoint curve segments. To achieve this, we use the 2π periodicity of the Fourier series of each segment to plot the segments for the parameter ranges [0, 2π], [4π, 6π], [8π, 10π], …, and in the interleaving intervals (2π, 4π), (6π, 8π), …, we make the curve coordinates purely imaginary. As a result, the curve cannot be drawn there, and we obtain disjoint curve segments. ...

Note that the Wolfram PSY curve is a parametric curve.

I would guess that the Wolfram PSY curve was created by drawing the curve first as a sequence of points in $\mathbb{R}^2$. This would correspond to a piece-wise affine ('linear') function $f:[0,1] \to \mathbb{R}^2$, with the property (among others) that $f(0)=f(1)$. Then take the Fourier series of $f$ and truncate at some point when the resulting curve looks reasonable.

This would be a straightforward (and tedious) way of drawing any 'closed' curve.

• So, it's kind of a pointillism artwork, followed by connecting the dots with piece-wise functions? – Poseidonium Jan 28 '13 at 6:36
• Hmm, I think embroidery would be a better metaphor given the underlying continuity; pointillism is more like pixelation in that it is essentially discrete... – copper.hat Jan 28 '13 at 6:41