I’m writing this post as an extension to the answer Casey gave last night on mathematics and game programming. Mathematics, and the education thereof, is a subject that hits close to home for me - so much so that I felt obligated to write this quick blurb directed at people who are questioning their math abilities, but who are interested in (game) programming. I will try to keep this short, since I could go on ad infinitum on the subject.
I don’t want to take anything away from Casey’s answer, but I want to share my thoughts from the other side of the fence. Casey is a phenomenal programmer who has taught himself the required mathematics - I am a mathematician, from a very highly regarded university, who is trying to teach himself how to program (though I now work in the software industry). The following rant is based off years of experience teaching students, and collaborating with faculty about what makes a successful math student at the university level.
The first point I would like to make, is that although I’m a mathematician, I consider myself a lousy programmer when measured up to people like Casey. So rest assured, we all have things we need to learn and improve upon :)
The second point, is about learning math. I believe, very strongly, that your ability to do well in these programs is in no way representative of your capacity to learn math. There are many reasons why this has become the case, which I won’t get into, but the result is that “math”, as far as the general public is concerned and that is taught in many of these programs, has been reduced to cheap parlor tricks, shortcuts, and memorization - all which completely contort, mask, and bastardize the underlying ideas. It makes me very sad hearing the general public talk about “math”.
Pure mathematics, at it’s heart, is an honest conversation you have with yourself about eternal truths; “do I understand this absolutely?”. All the notation is just a language developed so mathematicians can unambiguously communicate their ideas and understanding - don’t get lost in it. You can fake understanding on exams, or in conversations with people, but you can’t lie to yourself. Herein lies (one of) the connections I see between mathematics and programming; if you don’t understand exactly what you are doing, you are failing. After hearing Casey talk for a few weeks now, I am perfectly confident in his ability to learn math, and am not surprised at all that he was able to teach himself everything he needed. Why? Because when programming, Casey has the fortitude and conviction to dive deep and understand what is going on at low levels in the computer, at the CPU. Unfortunately, the computer is bound by physical laws and thus there is always a layer beneath that which we may never understand - but the dedication and devotion to his craft that drove him to this level of understanding is what is important - at least in mathematics - and I can only presume it is one of the reasons Casey is a great programmer. This is one of the reasons I felt encouraged to write this post directed at the viewers of Casey’s stream - just the fact you are here, following this project, and have the desire to learn the intricate, low level internals of what makes games tick without dependence on external libraries, makes me confident that this audience has the potential to succeed in mathematics.
So, if you’re not confident in your math abilities, what should you do? Analogously to programming, when you start, you should not start with something like Ruby - you are far too removed from the actual CPU. You should learn C, learn how the operating system and computer works, and build everything up from there (my, limited-experience, opinion). In math, this means that if you want to learn linear algebra, you should go to MIT’s course website, find out what book is being used in their first year linear algebra class (for mathematics majors!!) and read that book. You will have a far better shot learning the concepts of math staring at it in the face, rather than looking at a faint, foggy reflection of math through the veil of cheap parlor tricks. Then, when you’re learning, you need to be perfectly honest with yourself about what you do and don’t understand. Don’t move on until you truly understand the last concept. This takes discipline, time, and can sometimes be a painful mental process as you chase thoughts around in your own head - but it is the only way to make true progress. Mathematics is really a self-taught field; people can guide you in the right direction, but ultimately the onus and responsibility is on the learner to ensure they actually understand and can internalize the concepts. There appears to be a similar paradigm in computer science.
I believe explorations in mathematics can be extremely enlightening and rewarding. The logical foundation, and self-discipline developed while learning pure math can’t be understated. It is this shared desire to “understand” what is going on is what I think links people who are good at math and people who are good at programming (though I can really only speak for the former). Furthermore, developing a traditional mathematics background is certainly directly advantageous if you ever want to do any complexity analysis, or develop complex algorithms, data structures, compressions schemes, graphics, etc (it’s the reason I currently work in the industry!). But my overall message I would like to send to the audience of this project, is that if you are here, then I have confidence that you can learn the math needed to program games, if you truly want to.
- edited to remove personal vendetta against early mathematics education systems.
The second point, is about learning math. I can say, very confidently, that if you are taking highschool math, or even math in a computer science or electrical engineering program in university - you likely aren’t learning true mathematics [...]
I agree with what zoo is trying to say here, but I disagree (quite strongly!) with the way this is phrased.
I would put it this way: High school maths is to maths as playing scales is to music.
As anyone who has studied music knows, drilling scales is an important part of being a musician. They are a foundational skill on which other things can be built. They are important exercise to retrain your muscles. Scales are part of the vocabulary of European classical music.
However, no musician walks onto a stage and plays scales. Nobody gets into music to play scales. It isn't what a musician does when they are at their most musician-like.
This was a really interesting post, and I do see some similarities with other topics. However, and not sure if this is not the case in math, I have found out that sometimes the fact of continuing ahead even though I didn't fully understand something has helped me get to a point where some other concept that I did understand helped explain the previous one.
Then again, sometimes that lack of undertanding can really hinder progress... so I guess I believe it is ok to forge ahead as long you do realize there is a gap in your knowledge and should be mindful of it.
@pseudonym73. The point I was trying to make here, was to encourage those who may be struggling with high school math - since getting good grades in high school math and ones capacity to learn higher maths are sufficiently unrelated in my experience.
I think this analogy is deeper than you think it is, but it undercuts your point a little :) Yes, if you are _a musician_ you need to drill scales. But if you are _a composer_ you do not.
And that is largely the point about computer programming and math. The _computer_ is the musician, and _you_ are the composer. So most of the math drilling is a waste of time, and obscures the important things that you actually need to learn to be an effective programmer.
The point I was making was about what a mathematician does vs what they teach in high school. (And I do agree with zoo, especially the last point.)
I think, Casey, that you've made the exact mistake here that zoo identified, namely, the idea that "math" is arithmetic. The job of the mathematician isn't to do the calculation (especially not if it needs to be done a billion times), it's to prove that the calculation that will be done will give the right answer to the right problem. And if you're programming in a number-heavy area, that's the sort of thing you need to know.
I like the composer analogy. I think Math is more about learning to think differently than "how to do X thing" like factor polynomials or something. A lot of people approach it as the process. You obviously do need to learn some method to do a given thing, but learning to think about the relationships and whatnot at play in math is the actual goal.
Likewise in programming, in general or in a given specific field. You can be taught how to write a for loop in C++ to calculate the fibonacci sequence, but if you don't know what the heck is going on with what the computer is doing, and why that construct works at the level you're working at, well, fibonacci will be the extent of your "skills" so to speak.
This is a general life lesson. A surgeon is only good if he can adapt to the differences in the patients he operates on, including surprising things like having two appendixes or something.
That said, even in game programming, you don't need much more than add/sub/div/multi as far as "math" goes if you're using the right tools, so let's keep that in mind here too. It's ludicrous to call such a person an experienced game dev, but I know more than a few game devs that have published highly successful games without knowing much math.
Luckily, the goal of Handmade Hero doesn't seem to be skipping all that, and I think that's valuable. I just think it's valuable to realize the diversity of our ever growing (for good or ill) field of programming and recognize the tradeoffs we choose may not be the tradeoffs others choose. I personally recommend keeping math in anyone's toolbox, obviously, but I won't pretend it's needed for all lives, even programmers'
@Pseudo to continue on your analogy a bit, imagine that the only thing you did in music class is learn and play scales. Never playing or being expected to play a note of music. Scales for 15 years.
Also you never hear or experience music, just the instructor playing the next scale you have to learn.
Who would be a musician if that was all they knew of music? Would the idea of a composer even make sense to people who live in that world?
The destination of this line of thought, by the way (and the entire analogy we've been discussing), is well documented in the fantastic Lockhart's Lament.
The book Elements of Programming by Alexander Stepanov and Paul McJones is an exploration of one way of viewing the relation between programming and mathematics. Here I use mathematics in the "true" mathematics sense, viewing data-types and groups of data-types with a similar set of properties as algebraic structures, and defining the pre-/post conditions in terms of these higher-level structures. Of course, this leads away from the low-level bits&bytes view of programming but I find it useful if nothing else but as a tool to arrange my knowledge about algorithms & data-structures and how they relate and when they are applicable.
Zoo, I appreciate your post. Thank you for your contribution. I'd still like to get some clarification regarding your recommendation of C as the foundational language for learning how a computer really works. Wouldn't C++ be just as sufficient for such a thing? I mean, you have to do just as much memory management and manipulation of data structures as you would in C, right?
@rbc13183 I'm actually in no real position to be recommending languages to begin programming on, as I don't consider myself to be a good programmer, and lack experience in the field. I was just trying to draw an analogy to what this audience may have experienced while learning programming, and methods to approach mathematics; that is, dig deep to establish a base layer first and build up from there (as opposed to a top-down approach, where you begin by making many assumptions, and only possibly later exploring why those assumptions may be valid).
However, since the majority of my programming experience is in C/C++, I can say that C is easier to approach than C++. While both require careful understanding of memory management, C does so in a much more straightforward way. The added complexity of C++ doesn't really allow you to understand the computer at any greater depth than C does - it just adds facilities to aid in engineering and building large software systems (I actually started my programming adventures in C++, albeit for the wrong reasons, and would have done it differently in hindsight).
Do you recommend any particular resources for learning math at the level that you describe? Or does it mostly just come down to, as you said, one's determination to stick with a formula until they truly understand how it works?
I've done a good deal of gameplay scripting using Unrealscript (UnrealEngine scripting language), and Javascript, but I"m currently teaching myself C/C++, and I'd really like to beef up my math skills so that I can actually work in areas like graphics or physics.
YMMV, but in my experience, the language is less important to learning the math end of things in programming land, and much more important is understanding data structures and execution upon those data structures. For instance, a vector data structure is a common element in graphics programming, and vector math (often comparable to linear algebra) is also common. Both can be learned in a variety of languages where you learn the basic syntax and then the language mostly should get out of your way.
Again, your mileage may significantly vary, but get a good linear algebra book if you want to get into graphics. Beginning OpenGL is still a really good resource for starting that in my opinion.
It depends on your goals. If you just want to program in OpenGL (which I have never done), you may not need to understand the underlying math at work. I doubt many people in the industry understand how to construct the quaternions from ring/field axioms - and then prove the group isomorphism between the quotient group (H - {0}/R- {0}) and the rotation group in R[sup]3[/sup](SO[sub]3[/sub]) - which is why we're able to use quaternions to represent and compose orientations in R[sup]3[/sup]. For this, one would need to study the basic algebraic math structures: rings, fields, and groups. Note that this is a relatively long journey just to understand the above isomorphism. For physics, I presume you'll need to explore linear algebra, vector calculus, and differential equations to get started (may want to pick up a book on kinematics and dynamics too!). I would also recommend a brief introduction to real analysis before starting vector calculus and differential equations.
Again, it's about what you're trying to achieve. There's a difference between using a graphics library, and understanding the theory underlying how graphics work. But, regardless what math it is, if you've decided you want to understand it, go to the source and get a good math textbook (just check what books are being used by the better universities in their math programs).
As an addendum, I'll say that that on the outlook - this may seem like a lot - and it is, since many of these fields have deep and broad implications. However, very quickly you'll develop enough mathematical intuition that you'll be able to sift through the content and study just the parts that you actually need.