One of the fun* things about programming is how it gives you a new appreciation of math. I always liked math (wasn’t neccessarily very good at it, but liked it), but I mostly felt that when teachers and other adults tried to claim it was useful for your life, they were saying it because they had to, and didn’t really believe it themselves. I don’t remember many cases when I learned something in math and thought it would be useful for my daily life.
However, just like learning to write only becomes useful when you have something to say, math is also a useful skill just waiting for us to be advanced enough to have something to do with it. The example I currently feel is trigonometry – I learned it in school a long long time ago, and didn’t really see any relevance it had to my daily life. But now – at least the basic idea of sines and cosines has truly become part of my ordinary thought process.
The reason for that is movement. When I started, as a kid, playing around with programming languages and making primitive games, the obvious way to move things was in four directions – everything is lined on a two dimensional grid, your location is made of X and Y values, and moving is very simple – moving right means adding 1 to your X, left means subtracting 1 from X, down means adding 1 to Y, up means subtracting 1 from Y.
The problem is that this is very limited. It’s usually much nicer to allow movement in any possible direction. But it always seemed, at least psychologically, that this is much more complicated.
In reality, it’s kind of a chicken and egg problem. Allowing movement in any direction is very easy once you’re aware of basic trigonometry, and understanding trigonometry is very easy when you have a practical purpose to use it on. So all it took was the initial push, and now both problems are easily solved – now, when I have something that needs to be moved in 2D, it always has an angle and speed. And calculating the movement is not only very simple, it’s actually more elegant than the 4-directional movement. Because now I no longer have to treat 4 different options separately – at any angle, all you have to do is add S*Cosα to the X, S*Sinα to the Y (Where S is the speed and α is the angle), and that’s it. If I draw it, it looks so simple that it seems odd that it took so long to get used to it.
* I consider it fun. Perhaps not everyone will agree.