Learning math through programming

Many people seem to have the idea that in order to be a good programmer you have to be good at math.  Let me dispel that myth for you – I have always sucked at math.  My 5th grade math teacher even threw a blackboard eraser at me once in frustration when I could not get quadratic equations through my head!

That being said, when a friend of mine showed me QBasic when I was about 12, I seemed to have intuitively understood how code works.  Without ever having coded before, a few hours after being introduced to QBasic I made an ASCII drawing of a car move across the screen.  Since that moment I was hooked on programming.

It wasn’t until much later in life (after getting a C- in calculus) that I realized that I can learn math (and even become fairly good at it) through programming.  I began to seek out books that taught subjects such as math, biology, physics and statistics though coding examples.

The two books I want to tell you about are The Nature of Code by Daniel Shiffman and Coding the Matrix by Philip N Klein.

The Nature of Code uses examples written in a programming language called Processing to explain natural phenomena such as randomness, cellular automata, fractals and many others.  The books is extremely well written and the examples are so well commented and easy to follow that even if you don’t know Processing you should have no problems following every topic.


Coding the Matrix is a “textbook” on linear algebra that uses Python to explain the intricacies and complexities of matrices.  I have not finished the entire book yet, but from what I have seen and tried so far, it is a very worthwhile addition to your bookshelf.