Hacker News new | ask | show | jobs
by moadeel 5214 days ago
Thanks for the all the replies below, they clarify quite a bit. Here is another question, how much of the "incredibly difficult" math actually comes in handy and serves real coding purposes other than honing your ability to think logically? Math can be incredibly conceptual at times and as someone who has a psychology background, I know that a person can be not very good at math due to inability to think conceptually, but can be very downright logical on matters that he can understand practically. what do you guys think?
2 comments

While it depends on what you mean by "incredibly difficult", I would say that if you are doing any work with 3d modelling, it would be necessary to understand basic linear algebra. These concepts will transfer directly - if you are representing your model with points in 3-dimensional space, then displaying those points on a screen is a projection map, and can be described (and quickly calculated) with a matrix. This is a typical example.

Another common example would be a course in number theory. A common topic in number theory is public-key encryption, much more in-depth than is sometimes covered in other courses. In addition, the techniques that you learn in such a course can easily be applied to any "number-crunching" you would need to do. Here is an example:

Problem 1 from Project Euler (http://projecteuler.net/problem=1): Find the sum of all the multiples of 3 or 5 below 1000. A brute-force program for this is simple, but it is much faster if we first notice some patterns: (3 + 6 + 9 + ... + 999) = 3 * (1 + 2 + ... + 333). But then (1 + 2 + ... + 333) = 334333/2 (this would be easily recognized by someone who has taken a number theory class), and so the sum of all of the multiples of 3 below 1000 is 3 333 * 334 / 2. Similarly, for 5, there are 199 multiples, so the sum of all of these is 5 * 199 * 200 / 2. But then we must subtract the multiples of 15, since we double counted them: there are floor(1000/15) = 66, with sum 15 * 66 * 67 / 2. So the answer is (3 * 333 * 334 + 5 * 199 * 200 + 15 * 66 * 67)/2 = 299498.

That was a particularly trivial example - number theory will give you a lot more than some parlor tricks like the above. But this example took a loop through n numbers and reduced it to a single line of simple arithmetic. And for someone who understands number theory, this algorithm is as quick to think of as it is for a typical CS student to think of the brute-force algorithm.

I would also venture that a course or two in "Abstract Algebra" would be both beneficial and accessible to CS majors. This is less immediately practical than linear algebra in the above example, but closer in its style of thought to programming than, say, calculus, topology, or differential equations. The abstraction (which many math majors complain about) would be fairly straight forward for a CS major, I would think.

Thanks. Number theory sounds very interesting. I think I am going to pick up a book or a website on it ... really want to look into it.
I have seen many good programmers who are terrible in math. If someone is bad in math it doesn't mean he is less logical or less intelligent. It all comes down to interest of the student in the subject. For me math was always boring(other than algebra or geometry) as I was unable to understand the reason for learning it. I always used to think why in the hell I am supposed to learn this boring calculas. Where am I going to use it? So, bottom line is that I'm not good at math but I am a decent programmer if not a good one and math is not necessary to be a good programmer but it certainly gives you an edge if you are programming in some specific fields of computer science. For example, computer graphics.