Basic Mathematics

September 14, 2003 3:28 PM

Yesterday, I spent most of the day with Alan and David hacking on a Robocode-style game in Python. It was a good excuse to get my hands dirty with the language, and get some idea of what it's like to code in it.

(I am completely un-apologetically a Ruby hacker, which means that every time I try to write a Python app, I end up writing it in Ruby instead because that's what I'm more familiar with, and I can't really see any particular advantage in switching.)

Anyway, as part of the game, there are some pretty simple mathematics that need to be handled: coordinate geometry for the map, and predicting the movements of ships based on their thrust and speed of rotation and acceleration.

I sat staring at the screen for a very long time. It seems that ten years after leaving school (and five since I last studied mathematics in any meaningful way) my mathematical skills have atrophied to the point where I'd forgotten how the hell sine and cosine really worked.

Needless to say, this annoys me. I'll probably go out and buy one of those Physics for Games Developers books next week and re-learn a bunch of this stuff, but the very concept that my mathematics knowledge has atrophied back to grade 8 level just really, really shits me.

6 Comments

Isn't sine the y point on a circle with radius 1, with an angle in radians? And cosine the x equivalent?

That particular book is not going to do your selfesteem much good if you cannot remember how sinus work :)

Don't sweat it. Unless you've being doing graphics related programming you're maths will suffer. Mine has too becuase I've done been doing anything of a visual nature just data processing for the most part which doesn't excercise any geometry skills. I've recently grabbed hold of one of those GMAT / GRE Math prep books just to review my basic arithmetic skills and these are the basic stuff. They don't even deal with trigonometry since you don't have to know that for that GMAT. Only geometry and algebra. No calculus or matrix math either.

Thanks to my high school math teacher I will never forget:

SOHCAHTOA

Say it like the name of a small island in the south Pacific.

Key:

S - sine
C - cosine
T - tan
O - opposite side
A - adjacent side
H - hypotenuse

Therefore,

SOH -> sine is opposite side over the hypotenuse.

The rest are left as an exercise for the reader...

What you forget when unused must be variable among people, then, as I can recall not only the definitions of all of the trigonometric functions (10 years later) but also derivations of their transformations, graphs, etc. Of course I manage to forget where I put my keys and shoes the night before... probably would be handier to forget the math instead...

Good to hear you say that about Python; I feel the same way about Ruby. :)

Is the Robocode like thing going to be open or published at some point? It sounds like fun.

Comments are no longer being accepted for this blog entry. If you really want to make your voice heard, you can always email me.

Previously: How toLowerCase and isLowerCase Interact: Not a Bug.

Next: Verisign: the Ultimate in Typo-Squatting