In our last lesson we saw how we could take pretty much any complex number, plot its powers, and we would get a spiral. But these spirals all kind of looked the same and they flew out into space really fast. Let's try to make something that doesn't fly away so fast.
We're going to do something that might seem a little random at first, but be patient. Here is our plan. We will plot points so that:
The -th point is distance away from zero.
We rotate by the "Golden Ratio" each time - radians.
We'll need to write a new plot function for this, wo lets start there:
The numbers we plotted here are Eisentstein Integers. Look them up! Can you plot Gaussian Integers? Any other quadratic integers?
OK, back to work. Let's rotate by Golden Ratio and move out by and see what happens.
Does this look familiar? It's not a spiral, but do you see spirals?
Do the following exercises:
Plot 50 points and mark the clockwise spirals you see. Count them. Mark the counterclockwise spirals. Count them. (You can save the picture and open it in an image editor to do this). How many spirals were there in each direction?
Do the same for 100 points. Is it different? If so, are the old spirals still there?
Now 1000 points. Is it different?
It makes it a little easier to see these if we draw the Voronoi diagram for the points. The Voronoi diagram for a set of points comes from asking a simple question: for any point in the plane, what is the closest point from the set? We can think that a point in our set "owns" all of the points that are closer to it that to the other points. Now we can break the plane into regions owned by points in our list. Understanding these constructions is part of the field of Computational Geometry.
Let's compute the same point set, but now use the scipy Voronoi
function to compute a Voronoi diagram for us.
To understand what the Voronoi function does for us a little better, let's take a simpler example with just a few points ant print the whole data structure
The points
are just the points we put in. What are the vertices and regions? We'll talk about this in class.
Let's use these structures to color our diagram.
Play with this!
Plot more points, like this:
What happens to the spirals?
Now lets color the same points differently by changing colorModulus
:
What can you do with it? Do all color moduli work? Are some numbers special (like 21 and 34)? DO the spirals degenerate in the middle? On the outside?
You might need a better way to pick colors!