I've been pushing programming tasks on my Algebra 2 class. Pushing is the operative word.

Specifically, I've given them tasks that require them to use programs written in Python to do something related to what we are learning. Previously I showed them a program I wrote for a homework assignment as part of my work for Programming a Robotic Car , which went just fine for what it was: a short activity. I've also given them a few tasks during previous classes asking them to adjust a program I had written. IN one case this was to calculate a solution to a linear system; in another to evaluate the quadratic formula.

What I admit I did a bad job of, however, of making it clear why we would even want to do so. I think I erred on the side of them seeing how great it was that the computer could do this, which is silly considering I'm also pushing applications like Wolfram Alpha that do much more than my programs, and in a much more eye-catching way. I imagine it's sort of like showing my students a typewriter that can post on twitter and insisting they find it cool because such a thing exists. The power of programming is in making the computer do work that makes sense for a computer to do. The power of showing programming to students is to both demonstrate how a computer can do this type of work for them, and then empower the students to apply this knowledge on their own.

After reading a couple posts by David Wees on programming and mathematical thinking, I realized that I was doing things backwards. I needed to establish a reason for doing and teaching computational thinking. I was going to have some students out for athletics last week, and those tend to be the days when I experiment. I mentioned in the previous class with this group that I was planning to do a lesson with Python, and the reaction was instant and violently vocal. Those that were going to be out were thrilled. The others looked about as excited as if they learned that lunch for the following week would be nothing but spinach.

I designed the lesson knowing that if there was going to be any Python at all, it would need to be a task that justified itself quickly, clearly, and with as little trouble as possible.

The topic of the day was composition of functions. The warm up activity was this:

- Suppose f(x) = x^2. What is f(f(2))?
- This should also work for complex numbers. What is f(f(1 + i))?

What was neat was that a couple of the students were stuck on the first question playing around with it. I didn't have to ask a student to perform the composition three, then four, then five times to its own value - they did it on their own to postpone having to deal with the complex numbers. Not a problem. They got the point that they could do this, but that it was tedious. That was phase 1.

This came next:

The program they used can be found at http://repl.it/CMz .

They quickly figured out how to use the program to run a whole bunch of times. Some found that they weren't sure if an initial value escaped or not because the value was close to 1 or -1, so they figured out that they could change the number of iterations in the program to give them a better indication. Others realized they were looking at scientific notation and that they needed to review that that meant.

We talked about why the computer was the way to go for this, and then related it to the second warm up problem. Could it be possible to use the computer to do this for the**more**tedious task of managing complex numbers? Enter my second program at http://repl.it/CMz/3. The students used the second program to determine whether these points diverged/converged (I occasionally slipped these words in with hand motions to link them to escaping or being trapped) and found the concept pretty straight forward, as it had been with the points on the number line. I continued to ask them how they could do this manually using pencil and paper, and was met with groans - the computer clearly was the more logical tool to use for this. (Yes!) My final task for them was simple: plot the points that are trapped. I gave them this: I said I wanted them to color in any of the squares with bottom left hand corners that represented values that converged. That's a lot of grid squares, but that was kind of the point. There were nine in class that day, so they started dividing up the space. Some picked points randomly. Others were more methodical, with some starting to trace the border of the region, but generally there was only a scattering of filled points on the class copy where I had asked them to record their colored in grid squares. Having predicted how this would likely end, I was ready with this modified version of a Processing sketch written by Daniel Shiffman that basically did the entire task on the computer. The students were staring at the clock after doing this for about ten minutes and only having filled in a minimal portion of the plane. The students understandably said that this process was stupid and that there most likely was a better way for them to be spending their time. That's when I said they were right. You know when you design activities to carefully manipulate your students' emotions so as to realize a particular point, and it totally works? My students have a pretty distinctive facial expression that they each make when they realize I've done this, and right about then, it spread like wildfire through the class. I showed them this: This didn't contradict what they had come up with, but it was significantly more complete. I asked if there was any recognition, but there was none. So I decreased the pixel size more: Still no recognition, but there was more recognition that the shape of the region was an odd one. One more iteration made it pretty clear: We had looked at a video zooming into the Mandelbrot set earlier in the year, so they had seen it before. I wanted to push that the computer made it possible to investigate this sort of mathematics. This sort of thing could not have been done by hand at this level. Having the computer available to do repetitive calculations and construct graphs according to simple rules made it possible to investigate the mathematics of these areas in ways that were never known before. They were impressed that the mathematics of fractals was not investigated until 1980, which is recent enough for them to perhaps see that math is actually a dynamic field, in contrast to the way it is usually presented. I liked this lesson, and plan to continue to push my students to use computation when necessary. Our first unit problem for the exponential and logarithmic functions unit was a twist on the penny problem (get one penny the first day,two the second, four the third, and continue on for a month, or just take a lump sum of $50,000) and I insisted they use some computational tool to answer this, or just straight out find it extremely difficult. This is an important skill, and I believe in it. To make it happen, I am committing to deliberately committing time for students to learn how to use computers to do the computation work so we don't have to. I hope my days of seeing students solve the bee/train problem through tedious methods of manually adding terms together will soon be over.