Sunday, December 15, 2013

Let it Snow (flake)

If you're interested at all in learning or teaching math, you either have already read or you should probably read Don Cohen's mind-blowing Calculus By and For Young People, a tiny book that packs a huge wallop. In it, "The Mathman" busts the myth that you need 11 years of school math to even approach the ideas in Calculus by showing the work his students (children as young as 7) have done on infinite series, fractals, derivatives and integrals, pi, e and of course the Fibonacci Numbers. And continued fractions. And nested square roots.

Recently Don sent me some work a student did on converting repeating decimals to fractions. It reminded me of how long I studied Chapter 1 of his book a decade ago. Every math student I taught after that got to play around with infinite series until they discovered the deceptively simple formula Cohen reveals on page 9.

The book bounces around playfully until returning to the topic with Chapter 4: The Snowflake Curve, the greatest eight pages of any math book ever written. The aforementioned formula is used to calculate the area inside the Koch Snowflake fractal. The power and simplicity of the ideas in this tiny book still make me shake my head in disbelief. Buy it and do the math.

Drawing the Koch Snowflake was one of the programming projects I did recently with the students I teach at the Summit Charter schools in the SF Bay Area.

The challenge is to start with a triangle (level 0) and add little angles to the middle of every segment. Repeat for higher levels. 



The graphics above were made using the NetLogo application of the Logo programming language. But how do you get a turtle to stop in the middle of a segment? The answer is recursion. 

All the code necessary was found in Turtle Geometry by Ableson and diSessa, another brilliant book, which I found at a not-nearby library and bought shortly thereafter. I only had to modify the code a little to work in NetLogo, and surprisingly, the program is short and simple:


The "snowflake" procedure simply draws a triangle with three sides. It's the "sideprocedure where the magic happens. I had to tell the turtle how to make the little bend in the side. But notice that the "side" procedure contains the command "side"! It's like a recipe for baking a loaf of bread including the step "bake a loaf of bread." That's recursion. We humans would stop in our tracks at such a command but I guess computers have no problem with it. Anyway, you can have fun making a computer draw a curve with an infinite perimeter and a finite area or you can sharpen your pencil and prove it yourself!

No comments:

Post a Comment