Archive for the ‘didactics’ Category
If you are a programmer, you know that zero-indexed arrays and lists are just the right thing. Perhaps you read Dijkstra’s paper, or maybe you’ve encountered enough practical benefits to be convinced. But to non-programmers and students, zero-indexed lists seem extremely odd, and needs explanation. After all, we all know how to count, and it seems like it works OK when we start at one. What’s your good reason for starting at zero?
We have made this too complicated. While it is appropriate to have a careful answer for academic settings, we should have a casual illustration that is useful for casual inquiries. Here are my two suggestions:
When you look at NumPy, Python’s numerical library, the first object you will encounter is the
ndarray, or n-dimensional array. Also known as a matrix, right? Wait, there is also a
matrix class in the linalg submodule, that can’t be right. And worse,
matrix is not nearly as general as
ndarray, it only allows two dimensions. Is that really good enough for real-world data?
Based on experience in higher education, I’m confident that over 90% of those that have seen matrices missed the point. If you don’t know why a matrix must have exactly two dimensions, than you don’t know what a matrix really is. (So read on.)