Princeton Press just sent me a review copy of a new book by Frank Farris called Creating Symmetry: The Artful Mathematics of Wallpaper Patterns. It looks amazing and I’m super excited to read it. Apparently John Cook has been reading it as well, and posted some Python code for generating this curve, which shows up towards the beginning of the book:

Mike Croucher also posted an interactive version using Jupyter notebook, where you can play with sliders to control the parameters of the curve and watch it evolve.

This is a plot of the parametric equation

in the complex plane. In general, Farris considers parametric equations of the form

,

where are complex numbers, are integers, and as usual . All such equations correspond to cyclic plots in the complex plane; he analyzes what sorts of symmetry they will have based on the parameters .

He also spends some time talking about the aesthetics of picking values for and that result in beautiful curves. Instead of making carefully considered choices in this kind of situations, I often like to employ randomness to just generate a bunch of different instantiations and see what comes up (although there is still a certain amount of art in choosing the distributions for the random parameters). So, here are 50 random curves. Each one has

- Either 2, 3, or 4 terms
- Exponents chosen uniformly at random from
- Coefficients chosen uniformly at random from the square in the complex plane from to .

I really like seeing these all together. They are not all great individually, but as a group, it’s fun seeing their differences, similarities, and idiosyncracies.

Don’t ask me what the parameters are for an individual curve because the program I used to generate them does not save the parameters anywhere! The code is here if you want to see it; of course it is written in Haskell and uses the diagrams framework.

### Like this:

Like Loading...

*Related*

##
About Brent

Associate Professor of Computer Science at Hendrix College. Functional programmer, mathematician, teacher, pianist, follower of Jesus.

I’ve been interested in this all day, too. Here’s a GeoGebra version http://tube.geogebra.org/material/show/id/1292585

Cool, thanks! Could you also make a version that lets you fiddle with the coefficients as well as the exponents? I think the curve changes much more smoothly with the coefficients (i.e. small changes in the coefficients result in small changes in the curve), which is not at all the case with the exponents, so playing with the coefficients might feel more satisfying because you can more directly get a sense for how dragging the sliders would affect the curve.

Are Spirographs still a thing? I made hundreds of pictures like this as a kid in the 1970s using one.

They definitely are still a thing. I made lots of pictures with Spirograph as well when growing up.

This is both more general than Spirograph (since the different circular components can have different rates, not being limited to having to mesh via some teeth, and there can be more than two components) and also less general (there are only circular components, whereas Spirograph has other weird-shaped things as well).

If you only keep two terms they’re exactly hypotrochoids. Are they still if it’s a wheel on a wheel in a wheel? There’s a pretty nice online Spirograph applet: http://nathanfriend.io/inspirograph/

That was groovy. (My daughter dared me to use that word.) Good suggestion!

http://tube.geogebra.org/material/show/id/1294967

I agree, very groovy! =D

That’s another printable poster Brent, I like it!

“Mystery curve” is a hypotrochoid, no? At least the first 2 terms are, I think, and I assumed its mostly fair to call the 3 term version by the same name. I was playing with these a while back but didn’t understand how to pick coefficients & exponents that would always result in a curve with a small number of cycles. The complex form seems smarter and easier to understand & reason about than the parametric forms I usually see; looks like I need to read Farris’ book.

I dug up my lame attempts to map the space:

Very cool animations!

Spirograph definitely generates hypotrochoids. I am actually not sure that the mystery curve is one. You can think of it as a linkage of circles, where the center of each circle is attached to the rim of the previous circle, and the circles are spinning at different rates. I don’t think that’s equivalent to a circle rolling around another circle. I aim to make an animation to demonstrate this soon.

Pingback: Walking Randomly » Interactive ‘Mystery Curve’ using Jupyter notebook

Beautiful! Here’s a desmos version: https://www.desmos.com/calculator/s2jc5v0npm

Thanks!

Desmos is awesome! I made a tiny change and added sliders for the coefficients. Desmos lets you set ranges for your coefficients, and animate them too. I think n3 makes the coolest animation…

https://www.desmos.com/calculator/rdgq8cej6i

Oh, that’s super cool. And I was totally wrong about small changes in the exponents not leading to smooth changes to the curve!

Pingback: Mystery curve, animated | The Math Less Traveled

This got me inspired as well. Here’s one written in pure JavaScript:

http://wreck.wreckmath.com/games/parametric

Oh, beautiful! I really like the little boxes that let you pick arbitrary *complex* values for the coefficients by dragging around points in the complex plane!

Yeah, Nick, agreed – adding the phase to each coefficient is genius. 😉 I think it both helps you get a better feel for the space, and adds a great way to animate these things that is almost always interesting. With the default mystery curve parameters, I most enjoy dragging a2 in circles (adjusting only the phase), which causes all the loops to waltz around each other, like the Disneyland Tea Cups ride. I tried a little more animating building on your setup, by moving the coefficients in ellipses: https://youtu.be/myGXoLCnx-A

Pingback: Mystery curve | John D. Cook

Here is a collection, done with EMT.

Don’t know how to post code here.

Cool, thanks! What is EMT? One easy way to post code is to upload it to a site like pastebin.com, and then share the link here. For short code snippets you can also put the code in between <code> … </code> tags.

Euler Math Toolbox. I posted the code in its Forum. See

http://forum.euler-math-toolbox.de/viewtopic.php?t=185&p=712#p712

By the way, the curves should be computed with adaptive evaluation. EMT has a function for this. But due to laziness, I just took 5000 points around the circle. I think I will post a blog entry about this in my blog (observations.rene-grothmann.de).

Okay, just the lazy code with 5000 points:

>function plotone (a:vector,f:vector,r=none,grid=0,thickness=1) ...

$ t=linspace(0,2*pi,5000);

$ z=exp(I*t)+sum((a'*exp(I*f'*t))')';

$ if r==none then r=totalmax(abs(z))*1.05; endif;

$ plot2d(re(z),im(z),=r,=grid,=thickness);

$endfunction

>plotone([1/2,I/3],[6,-14],thickness=0.7):

Pingback: A mystery curve links to Jupyter | Newton Excel Bach, not (just) an Excel Blog