![]() Sam's attention was really captured thinking of new base shapes and trying to understand why they behave the way they do. Why does this one grow in size with the depth of recursion? Here was one where he suggested doing things a little differently with the peano curve.Īnd next is a variation on the Von Koch curve. As another point of comparison between these two fractals, the Peano curve is space-filling: the more deeply we recurse, the more completely the space is colored in (for example, this was level=4):īy the time we'd made these changes to the code and talked about a these two classic fractals, Sam started suggesting different base shapes to try. That's exactly what DrawFractalLine now does. Both involve replacing the middle of one segment with the same basic shape. But with the code in front of us the similarity of construction is quite concrete. In shape, the Von Koch snowflake and the Peano curve are markedly different. To DrawFractalLine :commands :level :lengthĭrawFractalLine :commands (sum -1 :level) (quotient :length 3.00) This is a small enough bit of code that one might reasonably ask "why bother?" However one additional change lets us reuse DrawFractalLine for another classic fractal: the Peano curve. It would be considerably more difficult and verbose to do this in Java or C#.) DrawFractalLine DrawFractalLine DrawFractalLine. Having worked with Rob "Once and only once" Nagler for five years now, I cannot look at a routine like DrawFractalLine without seeing the repetition. In other words, there's no extra value to be gained by setting the level any more than 6, and it's obviously not worth the significant extra time. The differences are smaller than the pixels on our screen - visually they are insignificant. What a concrete and compelling introduction to recursion compared to computer science tradition in the Fibonacci series!Īlthough I didn't go there while working with Sam, I realize while writing this there's an opportunity to plant seeds of understanding for "significant digits." We can only barely see a difference between a curves drawn with level=6 and level=7. A simple set of rules created a fairly complex shape. Watching the turtle draw each shape in real-time helped make clear what was happening. My first surprise was how quickly Sam began developing an intuitive grasp of recursion. ![]() At each level we divide the previous level's line segments into three pieces and replace the middle one with two sides of an equilateral triangle. Sam pretty quickly understood that we can compare level=0 with level=1 to understand the basic transformation that happens at each additional level of recursion. Having seen the above, we typed in the following: setup turtle then draw Koch's snowflake(5) procedure to clear screen and position turtleĬg setpensize 1 setpos right 60 clean pd Recursive procedure to line, fractalizedĭrawFractalLine (sum -1 :level) (quotient :length 3.00) In addition to all of my own criteria, this example introduces recursion and fractals. ![]() I've copied the code from that example below making minor changes to run it in MicroWorlds Logo. I found an example logo program in the Dictionary of Programming Languages which turned out to be even better than I expected. Working with someone else's code was an important dimension of this lesson. Then the two skills grow together, one complementing the other. ![]() When learning literacy, one begins with reading before writing. I searched the net a bit hoping to find something short and interesting, but with some repetition in its implementation that would help me teach how to remove repetition. Logo is a dialect of lisp and I was particularly interested in teaching Sam some different ways to use lists and functions. Last summer while volunteering for OWL I spent several weeks working with a fifth grader we'll call Sam who'd already blown through all of OWL's exercises. Logo, Fractals, and Recursion Programming, and Removing Repetition ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |