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.


  1. My name is Rania ,I am a student teacher in Brock university and as part of our Technology Integeration in the intermediate/Secondary classroom course our instructor Zoe branigan-pipe asked us to connect with a teacher who is teaching the same courses ,I am teaching Math and physics .
    I would like to ask you for a couple of advices as After 1 week i will go to my second teaching block where i am going to teach grade 9 both applied and academic ,so when i read your article now i really loved your approach and i would like to know more about it ,like which type of codes did you use ? and how did you introduce it to them ? and if you have any advices to me for teaching an applied class i would really appreciate it as i am really worried about this step i heard alot about how it is really challenging to keep them on task .
    By the way i followed you on Twitter as well i am @powerofteaching

  2. Rana,

    I used Turing which can be downloaded for free. I was going to use Processing but the coordinate system didn't match with the Cartesian Plane. We had Turing on the systems at school so I went with it.

    I introduced it as a pencil and paper activity to start. Had them plot on the grid. The next day I gave them some commands that would help them draw lines and a few shapes and just let them play. I circulated and answered any questions they had.

    In terms of applied classes, keep it interesting by using images and videos rather than just drawing on the board and try to do things in bite sized chunks. Routine is very important.

    Thanks for the comment. Good luck with your teaching block.