I showed M how to use a few basic commands in an L-systems Program. Basically what happens is he types in a simple code with F meaning to draw a line a distance forward, + and – meaning to change the angles. He sets up a simple code like FF+F+F. He sets the starting axiom as F, and the angle as 90. Then the program goes through and substitutes the whole code there for every F in the code…. so that basic code becomes FF+F+F and then FF+F+FFF+F+F+FF+F+F+FF+F+F and so on and so on. We don’t see the code at this point, we see an illustration drawn following the codes instructions. This one would be go forward two spaces, change angle, go forward once, change angle, go forward three times, change angle, go forward once…. on and on to produce a neat little graphic like this:
After playing with the program for a little while my son got curious as to how it works, and we sat down and wrote out a sample code by hand and then took our protractors and rulers and tried drawing it out. Our masterpieces in hand we went upstairs to compare with the computer’s rendition of the same code. M’s was pretty good. Mine I had measured the angles completely wrong. I thought I was measuring 45 degrees but to reproduce the picture I had made I had to alter the code to set the angle at 135 instead.
This is a new learning project for both of us. We have been exploring how changing the angle of a pattern changes the shape. Neither of us find long winding lines interesting, so we like the patterns to loop back on each other. To change a long winding line into a looped pattern we can either alter the code, alter the angle, or both. We are just barely able to write out a code and predict something of what it will be before we set the computer to create it.
The program only allows us to set one angle for the + or – to represent. However you can use multiples of it by putting multiple + or – signs together. You can backtrack along the same line by putting several change-angle signs together to make 180.
Another pattern I tried was F to start with, and then convert every F to FF+++F+F, angle being 60. The pattern it made intrigued me but I wanted to see how it worked so I wrote out what it would like after just a few steps. The interesting thing on it is that +++ ends up as 180 degrees, or switch direction. If I do it as 120 degrees then the picture is of a zig zagged line getting higher and higher, going several steps up for every step down.
So next I was curious about applying L-Systems to music. I took the code I had written up with FF+++F+F. The first question I had was should F equal play the same note and + mean play the next note, or should F equal play the next note, and + mean skip forward? I choose to have F mean play the next note, and + mean skip forward. Following that pattern and moving up from a low C up the piano keyboard I found that FF+++F+FFF+++F+F+++FF+++F+F+FF+++F+F would be C D * C E F G * F A * G A * G B * D E * D F. I marked stars in there to record where, when drawing with 60 angles, it would change directions and back-track. At those places I could play almost an octave higher than the previous note or I could just move one step down. In some ways the musical picture reflects both the pattern as done with 120 degrees and in other ways the way it is done with 60.