Programming for Discrete Math

  • Josephus Game
  • Magic Trick
  • Tennis Matches

I like using programming in the classroom. I’ve never seen programming really used much in any of the math classes I’ve had in the past, save from some odd MatLab projects (of course I opt for NumPy or SciLab – Go FOSS!), and sometimes reading paragraphs of math problem examples in a textbook just makes my eyes glaze over. Rather than try to demonstrate this stuff on the whiteboard, I decided to write some quick Python/PyGame programs for the examples from the textbook we’re using.

Another pro of this is that it helps me “grok” the content. I might read over something and think “yeah, that makes sense”, but I don’t really know it until I put it into practice, and the best way for me to put it into practice is to make it a program. When applying it in code, it’s more likely I’ll remember the fine details much better, just through the entire process of working on the program step-by-step.

Not sure if I’ll have my students do any coding (various prereqs, they might all know different languages), but it might be nice in the future!