Friday, September 14, 2018

Useful Math Visualizations

Over the years I've made some useful applications for people, which is very gratifying. Currently I'm seeing a program from a couple years ago come back around to see usefulness in the geometry classroom at my school due to the curiosity and insight of one of our math teachers, Matt DeGraff. He observed that such visualizations do aid in his students understanding of a problem and help them think about describing it in mathematical terms. His use of the program and our discussions about it are giving me the idea that a few different programs I've developed around it should be integrated into one to allow students to visualize a certain problem as an aide to seeing solutions and explaining them. Briefly, here are the three programs, more explanation to come:

Polygon vertex problem visualized as polygon

This program visualizes solutions to a problem posed and investigated in the Advanced Problem Solving class taught by Benjamin Dickman, The Hewitt School. The problem posed is "for any regular polygon of n sides, for which n-gons are all of the vertices touched as step size is incremented sequentially?" The program does not prove the n-gons that can be completed but it does illustrate how each one works out. 

Polygon vertex problem graphed

This program visualizes the same problem but changes the visualization of the results to graphed data. This was actually the program Matt had been having his students use recently in his class. I then sent him the first program that draws the polygon because he said the students did have trouble grasping what was being counted with the graphed visualization.
The other thing he told me was he was going into the code and setting the statement that increments the step size to 0, then setting the step size itself to a fixed number, say, 5. This was a simpler problem for the students to think about. He hadn't even posed the problem of an incrementing step size to them. I liked that he sort of hacked my program to make it do what he needed. 

Polygon vertex problem connecting vertices

As we talked about the mathematical ideas Matt mentioned it would be cool for the program to draw lines between each vertex as it steps around the polygon. I thought about that and quickly realized that would be a very hard feature to add in to this program. The program is written in Python using the Python Turtle module to step around the polygon's vertices. Turtle Geometry was an easy paradigm for me to realize the original visualization because the angle of rotation and size of each step is easily determined by dividing 360 by the number of sides, which all goes back to Turtle Geometry's Total Turtle Trip theorem (search Total Turtle Trip here). Drawing lines between non-adjacent vertices is another story altogether, requiring a much more complicated algorithm (to me at least). I could see that Cartesian Geometry and a bit of Trigonometry would make this much easier as it allows for finding the x and y coordinate of any position on the circle bounding the polygon using sine and cosine functions:

For that I went with P5 and its robust vocabulary for programming graphics. It's also hosted on Glitch for easy shareability.  So this program does not count the times each vertex is touched as steps around are made, but rather draws a line from each step to the next to depict a star shape in the center of the polygon. 

Polygon Vertex Problem Connecting Vertices and Incrementing Steps

Actually, here is a fourth program! It occurred to me it might be interesting to add back in the step incrementing to the star program to see what shapes are traced across the vertices. This is the result.

What to do with all this?

So these four programs are tied together by two variations of a problem; marking the steps around regular polygons. Should they all become one piece of software? This could enable you to visualize different aspects of the original problem. It is possible that non-incrementing and incrementing approaches to stepping around the polygon are very different problems and don't belong together. I will have to consult with my math friends for more thoughts about this.

No comments :