# Lines Can Be Fun

Computer Science Teacher

### Lines Can Be Fun

Graphics can be a lot of fun for students. Well honestly they are fun  for a lot of adults. Recently I read a blog post by Cate Huston (Experimenting with a Visual, Activity-Based Curriculum) about some totally visual, graphical project based learning she was working on. Leading off was an image that brought back lots of fond memories for me. You see back in the old days before graphical capable monitors our best, often only, way to do colorful graphics was via dumb plotters. It was with one of those that I discovered computer graphics and with that the interested things one could do with straight lines. For years (dare I suggest decades) my graphical version of “Hello World” has looked something like this.

Don’t you just love the patterns? OK may be it is just me. The code for this example is in Small Basic BTW and looks like this:

Pretty simple. The first version of that I ever wrote was in FORTRAN and I’ve lost count of how many times I have written it since. It’s a simple fun example and it makes a good demonstration of simple looping. But you can get a lot more complicated. You can also have it draw in all four corners like the sample on Cate’s blog post.

One of my favorite programs from college was a program that drew shapes based on how many sides I asked for. OK that was too simple so I then had the program rotate the shape and shrink it until small and then increase the size until full sized again.What did you get? Something like this.

Those are obviously three and seven sided figures. (That program is written in Visual Basic FWIW) There are patterns in both that I never anticipated before I had the computer draw them for the first time. They are caused by moiré patterns BTW. A two sided shape really surprised me but I leave drawing that to the student.  In fact it was the surprises that made this program so much fun for me.

Several of my friends experimented with graphing different equations while we were in college. Some of them created some very interesting designs that way. I think when we think graphing equations we look at things that are linear or very simple but a real mathematician can, I am sure, find some equations that are a lot more visually interesting and dare I suggest surprising to students. It seems to me that a bit of a surprise  can be a good thing. We need more of it!

• I did my master’s thesis on methods of drawing conic sections using Apple Logo.  Fancy string art in other words.  The graphs looked like your “Hello World” art.  I then graduated to drawing Mandelbrot and Julia sets pixel by pixel on the Apple IIe.  I am sure some of you are familiar with this.  Hit the GO key when you go home, come back in the morning to see what was drawn.  Spend hours redesigning your algorithm to make it draw faster.  Design a zoom feature that again took hours for the redraw.  Boy, those were the days.  Doing graphics with the kids seems to kill three birds with one stone; computational mathematics, geometry and programming.  And best of all, they think it is fun.  It is amazing the amount of work kids (and adults) will do if they think it is fun.

• Fun is a great motivator for sure. What  I would really like to see is more math teachers using fun/visually interesting graphs and some simple programming to make math more fun for students. It seems like that would be helpful on several levels.

• I'm glad you liked that image! It's one of my favorites to give the students because the idea that they can do it with one loop and 4 lines of code (8 with color changes) seems incredible... until they work out that you can use straight lines to make that pattern!

Inspired to think up some new shape-based patterns now...

Page 1 of 1 (3 items)