Wednesday, December 12, 2012

Integrating Math & Computer Science

Given that it's CS Ed Week  I thought it was about time I posted this.

I've always thought it would be great to teach an integrated math and computer science course. The subjects compliment each other so well. They both involve a great deal of problem solving and logical thinking. The computer science portion of the course would also allow students to see math as a creative endeavour, something that is often missing from high school courses. The course could cover the mathematics that needs to be covered and allow students to apply the math in a variety of different ways. Imagine what it would be like to have students program a game similar to Angry Birds using their new knowledge of quadratic functions or to have them write a program that solves equations. What better way is there to understand a concept than to teach a computer to do it?

As I work to make such a course a reality I decided 'Why wait?'. Why not start doing a little programming as part of my math course. So a little over a month ago I decided to work some programming into the already packed grade nine academic math course. We were working on the analytic geometry unit (slopes, equations of lines, etc.) and  I had my students complete two separate tasks.

The first task was to write a program that drew an image on the screen. I suggested a simple house but encouraged them to be more creative. Their image had to have at least four lines: one sloping up and to the right, one sloping down and to the right, one that was vertical and one that was horizontal. They first created a sketch on grid paper and then wrote their programs. This part of the assignment was a good way to review plotting points. Once their image was complete their program had to calculate the slope of the lines mentioned above. Once the slopes were calculated students were to keep one end of the lines fixed, while the other end collapsed towards the bottom of the screen. This was done in stages and at each stage the slope of the line was recalculated. The goal here was for students to make connections between the steepness of a line and the slope and to reinforce what it means for a line to have a positive or a negative slope. Overall I would say that students enjoyed this task. Some of them were very creative in their designs and some of them explored graphic options well beyond what I was asking them to do. There were very few coding constructs used which meant I didn't have to spend a lot of time teaching how to program.

The second task that I gave my students was to write a program that would ask a user for two points and then calculate the equation of the line between the two points. The goal here was for them to solidify in their minds the procedure for finding the equation of a line. This task involved a lot more programming concepts than the previous one did (variables declarations, assignment, input) and as such was a little more challenging in a very short period of time. In the future I'd like to do it again but I would spend a day just working on the basics of programming. I think by the end many students managed to get a few of the programming concepts but it was hard work getting there. This reaffirms my belief that teaching this as an integrated two credit course would be much more beneficial to students. Overall I'd say that this task wasn't as interesting as the first one, but I think it helped students with the math concepts we were working on. Now I just need to find more time so that students can create a game that uses equations of lines.

More and more I see computer science type applications that are easy to integrate into existing math courses (spreadsheets, 3-D modelling, programming, databases, etc.). I hope to make an effort to integrate these applications into the math course I teach wherever possible. My ultimate goal is to teach an integrated math/computer science course, but failing that I will bring the computer science into math when I can.