How I Created Spirographs in Excel
Exploring parametric equations using Excel
There is geometry in the humming of the strings, there is music in the spacing of the spheres. — Pythagoras
You can find the how-to below Excel sheet included…
Growing up I had a toy called a spirograph which was passed down from my parents. I loved it. It generated complex patterns and the stencils would go around and around the circle. At 8 years old, it was quite magical.
It was simple to use. I’d use the gear with multiple holes inside the larger doughnut ring and place the pen in a hole and generate these patterns.
20 years later, my tools have changed a little bit. Yet, I’ve found that my love for complex patterns hasn’t changed. Yes, I’ve found new frameworks to discover these patterns. And it doesn’t fail to amaze me what you can do and where the imagination can go. Generally, I’d be using the Processing library from the Processing Foundation (a simplified form of Java) to generate some beautiful images here. There are others out there as well such as OpenFrameworks, Nannou, and Cinder.
But I used something quite different this time. It started while I was working through a statistics book and I was reintroduced to parametric equations. So I started exploring them a more by running the equations through Excel and plotting them as this was to verify the reading and gain some intuition and better understand parametric equations.
Parametric Equations
A parametric equation is simply an alternative way to view a function. Generally used in kinematic problems (basic physics problems) problems or equations to describe a property such as the trajectory of a rocket or the orbit of a planet orbiting around a body of mass.
Consider the following function which creates a parabola.
Now to take that function, we can decompose (using highschool algebra) the above equation by isolating X and Y by itself and generating a separate parameter whose input is t as the following functions show.
Essentially if you create a table of these two interpretations of the function; they yield the same answer.
Straight forward right?
Essentially when you use two functions to generate your X and Y coordinates we can produce a large corpus of graphics that you have seen throughout this post. (Mind you this is just one set of equations) as you we see further below.
So now to the fun part, following I’ve outlined the process in which I generated all of the many shapes throughout this post.
How to create in Excel
- Open a new sheet and create the following in your sheet.
2. For all of the images in this post, I have added the coefficients a, b to the figure legend, and spaced out the (2 ≥ t ≤ 2000) which I just pulled down in my sheet.
3. For X use the following formula starting in C6
=($C$2-$D$2)*COS(B6)+$D$2*COS(B6*(($C$2/$D$2)-1))
4. For Y use the following formula starting in D6
=($C$2-$D$2)*SIN(B6)-$D$2*SIN(B6*(($C$2/$D$2)-1))
5. Pull down all of the formulas so that X and Y are populated down t=2000 and highlight X and Y.
6. Go to the home ribbon and select scatterplot and press scatter (XY) with smooth lines.
Note you can also change the chart type and it looks something like this:
7. Now remove the X and Y axis, and readjust the size of the image so that you have an image that you find interesting.
And then you have your image which then can be exported as an image. Now you can play with it by adjusting the coefficients to change up the different structures the parametric images create. Also, you can change the background color and image to new colors by selecting the component of the image to change and use the format tools and selecting the shape fill and shape outline.
Or you can download the Excel sheet from Dropbox.
So in order to add text, use any picture editor or even in Excel which you can then either screenshot or export the image which then can be used in your artwork.
References
- Parametric equation — a definition https://en.wikipedia.org/wiki/Parametric_equation
- A more detailed look at parametric equations http://sites.millersville.edu/bikenaga/calculus/parametric-equations/parametric-equations.html
- Excel https://www.microsoft.com/en-us/microsoft-365/excel