The Mathematician As Artist, 2019 Edition

It’s Winterim again at Harpeth Hall School. This three-week interval between semesters is an opportunity for teachers and students to enjoy an alternative curriculum and pursue topics that are not often taught in a traditional course.

This year I am once again teaching my Mathematician As Artist course. We began by creating art using only a straight-edge and compass. These designs were based on a process pioneered by Dearing Wang:

Next, we constructed Voronoi Diagrams by hand. Here’s an excellent tutorial on the process. In a Voronoi Diagram, each color represents all the points that are closest to the node (the black point) within that color.

Our latest project involved using Chaoscope to create fractals. It’s an easy program for a beginner, but there are endless options for more advanced users. Here are the students’ pieces:

I will do a separate post for my students’ final projects – stained-glass windows!

 

Coding With Processing, Part 3

I just learned about for loops in Processing, and it occurred to me that they are perfect for illustrating iterated function systems. The classic example of an iterated function system is where you start with three vertices of a triangle, labeled 1, 2, and 3. Then perform the following steps:

  1. Plot a point (x0, y0) anywhere inside the triangle.
  2. Use a random number generator to generate 1, 2, or 3 randomly.
  3. If 1 comes up, plot the midpoint between vertex #1 and (x0, y0).
  4. If 2 comes up, plot the midpoint between vertex #2 and (x0, y0).
  5. If 3 comes up, plot the midpoint between vertex #3 and (x0, y0).
  6. Make your new point (x0, y0).
  7. Repeat the process.

Even though the locations of the points are being generated randomly, a very interesting picture emerges. Here is after 100 iterations:

And here is the result after 1000 iterations:

And here it is after 10,000. It’s pretty clear that we’re getting the Sierpinski Triangle!

Here’s the code:

float x1 = width/2;
float y1 = 0;
float x2 = 0;
float y2 = height;
float x3 = width;
float y3 = height;

float x0 = width/2;
float y0 = height/2;

size(600, 600);
background(0);
stroke(255);
frameRate(5);

for (int i = 1; i < 10000; i = i + 1) {
int roll = int (random(0, 4));
if (roll == 1) {
x0 = (x0 + x1)/2;
y0 = (y0 + y1)/2;
point(x0, y0);
} else if (roll == 2) {
x0 = (x0 + x2)/2;
y0 = (y0 + y2)/2;
point(x0, y0);
} else {
x0 = (x0 + x3)/2;
y0 = (y0 + y3)/2;
point(x0, y0);
}
}

Fractals and Kindles

I just can’t help myself. Whenever I get a new gadget, I have to customize it. When my wife and daughters gave me a Kindle four years ago, I was thrilled. It’s a Kindle 3, and it opened to me the amazing world of ebooks. My library now includes collections of G. K. Chesterton, Charles Dickens, Fyodor Dostoyevsky, and Shakespeare. I like the fact that the screen isn’t backlit, so there is no eye strain. It’s a wonderful device that has completely changed the way I purchase and read books.

However, I thought the screensavers that Amazon preloaded on the Kindle were really unattractive, so I tried to replace them with images more to my liking. Easier said than done! I assumed that all I had to do was locate the folder containing the screensaver files and dump my own in there. It turns out Amazon does not want you poking around in there, so that folder is hidden.

Fortunately, after a little research online, I was able to hack into my Kindle and change the screensavers. There are thousands of great images online to choose from (just Google “Kindle screensavers”), and I had a blast exploring them. Then it occurred to me that I could create my own fractal screensavers – all that is necessary is to make sure they are gray-scale images that are 600 by 800 in size.

I decided to use Chaoscope to create my screensavers. (I posted a tutorial on how to use Chaoscope here.) Make sure you render them in either Gas or Liquid mode. My first batch is posted below. They are already correctly sized – just click on a thumbnail to access the full-size image, and then save it to your computer. Enjoy!