I’m Attracted to Attractors

So many plots and mathematical musings throughout my life have brought on a sense of artistic beauty and awe within my being. In the windowless halls of engineering firms I have smiled at harmonics, or in a homeschooling room squealed in glee when I stumbled upon Pisano periods by trying to play Fibonacci on the piano. Lately I have been playing with attractors. These dynamic systems make me stay up late fiddling with their metamorphic and chaotic beauty.

I came from a Matlab world and have had to teach myself some more cost efficient means of play with javascript and python. The code below is just one of my playgrounds. I don’t know if there is a name for this attractor (please let me know if you know its name). Enjoy:


With functions you have inputs (x) and outputs (y) that can be plotted on a plane (x,y). With the images below, the x and y values are computed using an initial value of (1,1) and then the next (x,y) is computed using the previous coordinate’s values. The equations are shown below:

x = sin(a1 * oldx) * cos(a1 * oldy) – sin(a2 * oldx);
y = cos(a3 * oldx) – cos(a3 * oldx) * sin(a4 * oldy);

Here is a gallery of some of my outputs:

For the images above, I calculated x and y using a1, a2, a3 and a4 coefficients and the previous x and y values (oldx, oldy). The initial point was (1,1). In the code below, there are only 300,000 points (compared to millions in higher res images). You can play with the values of a1, a2, a3, and a4.

See the Pen webcode by Sophia (@fractalkitty) on CodePen.

I like the p5.js editor. Click here to play. I would say that fiddling with this is a great idea for an “Hour of Code.”

If you like to play with sheets or excel, which is not near as pretty, I made a sheet for you here. This is also handy if you want to see the array of values for (x,y).

Week 15: String Art

This is a classic, yet fun activity with math:

  • Start with a compass or protractor and create a circle with evenly spaced points around it. Students can figure out how many degrees need to be between points (example: if you want 10 points, then there are 36 degrees between each point, for 9 points : 40 degrees, etc.)
  • Draw your circle and points on a board
  • Place pins or nails in your board
  • Wrap string in various patterns and see what emerges.
    • Students can study remainders (mod functions), multiplication, and sequences.
    • Star patterns, secondary polyhedra, and cardioids may emerge.
  • If you don’t have wood and nails, then this can be done on paper with a pencil and ruler or sewing with string on paper.
  • Encourage students to look at other shapes, axese, or lines and create works of art. (boards can be painted, multiple colors and thicknesses of string can be used, and students can contemplate 3-dimensional approaches for this art (like with dowels).