Think of a graphic engine for a video game. If the first thing that comes to your minde is it's difficult, you're not alone. It's difficult because the mathematics structures and theories behind it are not general knowledge: they are a specific algebra topics which many of us do not master. Otherwise, if you see a !($a or $b) statement probably you know how to write an equivalent form.
So how can you learn all this stuff?
The programming field is broader than ever, and there are more and more mathematics instruments used in computing. A modern programmer should be a jack-of-all-trades in his mathematical side, as he should learn the majority of the specific disciplines as needed by his profession, while mastering the foundations which he encounters every day.
I have made a breakdown of the main arguments taught in high school and university which are utilized in computer science. I divided this list in a basic section and specific applications one.
Basic list (what you should certainly know):
- Set theory and relations: used in the relational model without most people knowing, and also as terminology in modern languages (List vs. Set).
- Functions: there is a resemblance in mathematical functions and programming ones. Functional programming is an approach coherent and taken to the extreme. The lack of side effects is another strong similarity.
- First order logic: De Morgan laws are a powerful example of refactoring applied to if statements. A strong foundation for something you will write forever: conditional expressions.
- Differential and integral calculus (in one variable): they are general knowledge. Handy when dealing with disparate problems, for example maximums and minimums of an expression.
- Enumerative combinatorics: scary name for permutations and combinations. Counting items is a recurring task.
- Computational complexity: to know when an algorithm performs better than another.
Specific applications of mathematics (what you can learn as needed):
- Trigonometry: you can take advantage of trigonometric functions while solving geometric and 2d graphics problems.
- Analytic geometry and linear algebra: a fundamental in 3d graphics. Rotating an object involves matrix multiplications.
- Abstract algebra: groups, rings, fields and so on. These are structures which are used to solve very specific problems. For instance, you can solve the Rubik's Cube with enough group theory.
- Vector and multivariable calculus: also useful in anything that involves manipulation or simulation of physical objects. The law of physics you want to simulate are formulated in these terms. Though, these are engineering concepts instead of general computer science ones.
- Statistic and probability theory: the world is not deterministic and some models should take into account natural variability of the data they act upon.
- Complex numbers: probably useful only if you are treating signals and dynamic systems.
- Financial mathematics: interests and present values are not a simple topic as they can seem.
The image at the top is a standard Rubik's Cube. Can you solve it? It is a pure mathematical problem, the time for studying it is the only requirement. People who master the math behind it can solve the problem in a few minutes (and often less).
I don't think you need to know all that math for a lot of programming jobs/tasks/industries.
ReplyDeleteBut the funny thing is, you miss one math that you really do need to know if you're in the graphics industry: linear algebra.
So you put all the useless math on the list, but one discipline that's actually useful is not on it.
You should provide some links to places where the subjects can be learnt.
ReplyDelete"[...] the world is not deterministic [...]"
ReplyDeletewtf???
Let me just add that you do not need to learn these things at once, but as you see it fit. Learning about all these things can take a very long time. Even if it's been part of your curriculum you've not REALLY mastered calculus, for example, until you can build up calculus from the ground up from axioms about real numbers.
ReplyDeleteTake your time prove theorems and work your way through this.
What are you talking about, linear algebra is right next to analytic geometry
ReplyDeleteTrigonometry is the subject we are study at school in Russia. :\
ReplyDeleteSomeone asked about resources to learn math. Here are a few I've used to teach myself some concepts I missed out on in school.
ReplyDeletehttp://www.khanacademy.org/
http://www.mathtv.com/
http://www.e-booksdirectory.com/listing.php?category=3
Good luck
You don't need math in programming. You supposed to be very good in analysis, understanding the ins-and-outs of the technology, creativity and the proactive attitude in any aspect in programming. It means that you should learned all yours and other mistakes. Deliver the right solutions. How do you get these attributes? by good experience.
ReplyDeleteNope, you do need mathematics in programming unless you're planning on being a monkey coder.
ReplyDeleteKinda like you don't need to know how to make soap to be a floor mopper.
It's silly to try to learn all this under than 1-2 years though. Take your time
Our lead developer has a major in Psychology. Our tech manager has a major Sociology. Guess what... I just gratuated a 2 year computer science certificate and got MCSD in .NET and SCJP.
ReplyDelete-Deepta
Yes, you need to know mathematics unless you want to be a monkey coder indeed, which I used to be.
ReplyDeleteWith the proper math I was able to move into much more interesting work.
I suppose this is a matter of taste about what you find interesting.
I would say that statistic and probability theory is very good for general programmers in a number of ways. General estimation skills, problem determination, cost/benefit analysis, etc etc. I wouldn't give it up.
ReplyDeleteI do not know if you clearly make this differentiation, but I would also remove geometry from calculus for general programmers.
"teached in high school" ? I guess you slept through English class when they TAUGHT proper conjugation.
ReplyDeleteAnd I am a douche...
ReplyDelete-Deepta
You don't learn all that because you WILL have to apply them a project. You learn them because you MIGHT need them for a project.
ReplyDelete"A modern programmer should be a jack-of-all-trades in his mathematical side, as he should learn the majority of the specific disciplines as needed by his profession, while mastering the foundations which he encounters every day."
ReplyDeleteThis overemphasis on men is incredibly sexist. Please phrase these types of things more appropriately in the future.
It's opposite day today so sexism is actually a good thing.
ReplyDeleteOf all these areas of mathematics, I think set theory has proven the most useful. Along with that, I find that I use predicate logic quite often. A good logic foundation allows you to create more concise and responsive code. I probably apply DeMorgan's theorem about 10 times a day, on the macro and micro levels.
ReplyDeleteThanks :-) I like your article and your idea to list in short and clear way math.
ReplyDeleteMay be one of your friends posted yesterday this blog post :-) to Anonymous question. Nice post, of course it is open and every body can add useful links.
http://www.ekoob.com/best-sites-to-quickly-calculate-mathscientific-calculations-6627/
I should be glad to have you, as a friend on Facebook, if you spend some time there :-)
Have a nice day!
This sounds like it was written either by someone who is NOT a programmer, or else by someone who is a programmer and has now discovered that it's not nearly as glamourous or impressive as they thought it would be.
ReplyDeleteIf the latter (as I suspect), then this is someone who wishes that their "programmer" job commanded more respect or street cred than they've been getting lately.
I've been programming, professionally, for over twenty years now. I can tell you from experience, it never gets any better. It's always like this.
You will always be a geek no matter how long your mathematical "shoutout and greetz" list grows.
And the truth is, programming is very often dull, uninspiring, often non-technical, often not even challenging (after so many years), and just plain boring.
Let's face it: When you first began, programming was FUN! Writing programs to solve your own problems was like MAGIC. But then you decide to put that magic out to hire and you soon learn that writing programs to solve everybody ELSE's problems is just plain boring.
If that's you... dude.... welcome to the world of professional programming.
The biggest one you missed is admittedly a broad abstract concept, but:
ReplyDeleteLearning how to construct a complex and airtight mathematical proof.
The area in which you do this is almost irrelevant, but the more mathematical fields you can learn to do this in, the better you will be at writing good code, and the broader your talents will be.
I have removed some offensive comments.
ReplyDeleteHowever, many of the reasons for a solid mathematical foundation have been listed from other readers: more interesting work and deeper understanding of programming concepts (aka "not being a monkey coder"). If being a programmer is considered a profession, we should take it seriously. Of course some disciplines are only needed in specifical projects but often they are underestimated even there.
For learning, wikipedia provides a 50000 feet view on these subjects, but I think real books are still the best way to learn advanced math and I can't link physical pages here. :)
Kyle, my mother tongue is Italian and in my language defaulting to the male gender is the norm. Do you have any suggestion of how I can rephrase similar sentences? I have seen many phrases expressed with she in programming books, in similar constructs.
Seahorse, add me if you want. Search for "Giorgio Sironi".
Kirby,
ReplyDeleteI have worked as a programmer for the last years, but I'm studying to become an engineer. As you may know programmer skills are a subset of an engineer's ones. Maybe this mindset is the reason why I stress my desire for mathematics and deep understanding of programming techniques, since my job will be not to use them only but also to design new ones.
This comment has been removed by the author.
ReplyDeleteI really wouldnt worry about the his/her gender refrences. There is absolutely no reason for anyone to genuinely be offended by such a thing. The book "c# for dummies" for example refers to all person's as "she" and "her" and that didnt bother me at all. You can replace it all with "person" and "them" but then some sentances become akward and you could even argue it lacks the personal touch perhaps. At the end of the day, you could argue about anything :/
ReplyDeleteLoosen up, its an article about programmers maths. If people took offence less easilly maybe we'd have less wars and hate crimes eh?
A little high school algebra goes a long long way.
ReplyDeleteSome graph theory is nice to have, too.
See also here: Do we need to know basic math as programmers?
ReplyDeleteIt's interesting how many people feel offended by this post, probably because they do *not* know math very well / at all? Either way, it doesnt matter. No need to feel offended.
ReplyDelete@jto: I agree, graph theory has lots of uses in practice. I've needed graph theory quite a lot already.
@Giorgio: What do you mean by "engineer"? "Software Engineer"? Personally I still find the term engineer/engineering misplaced in the world of software development. Maybe one day it will fit. This is a very interesting post: http://www.artima.com/weblogs/viewpost.jsp?thread=255898
Whether you need math and how much of it you need really depends on the field you're working in. You can not say programmers need math or dont need math. A lot of them indeed dont need any advanced math beyond the absolute basics. Simply because a bulk of the programmers are simply told what to do and do boring tasks. They code what they're told to. If there was something complicated to solve before, then other people did that already before assigning them the tasks. Programmers that are just "end users" of software and frameworks and tools usually need to know much less than the ones who write these frameworks, tools and programming languages (which is good, after all thats the goal of building these tools, to get higher levels of abstraction).
So it really depends on what you work on. You can certainly be a software developer without much math knowledge, it just wont get you very far and you miss out on a lot of interesting working areas.
And ... it really doesnt hurt to know some math ;)
for those who have fun in maths:
ReplyDeletehttp://projecteuler.net/
I want to add--
ReplyDeleteWow, Kirby L. Wallace is bitter.
Math isn't important in every programming job, only the interesting ones.
I work on something pretty complicated and hard. Just to be able to review other people's patches I have to construct proofs, find the implicit invariants in existing code--it involves a lot of mathematical thinking, though not in any particular mathematical field.
It's fun.
Kirby, you're not a programmer. Programming is eternally fun and challenging, and real programmers always have a side-project cooking up outside of the day-job. If programming were so boring, and a repetitive task, programmers ages ago would have written nice programs to write other programs.
ReplyDeleteIf you don't find other people's problems as interesting (or more so, even) than your own, you've picked the wrong profession. That, or you need to try the indie road, but I seriously doubt your ideas are all that grand.
I agree with the post, that math is important, and the more math you know the better off you'll be. One part stands out though: "the world is not deterministic". Probability exists in the mind, dude. The universe isn't uncertain.
Trust me a MONKEY CODER is still a MONKEY CODER forever.
ReplyDeleteI am a douche ? Yeah right... Remind me that next week when your boss outsource your job to us.
And there is NO mathematical model in coding. We do have standard coding.
- Deepta
Roman,
ReplyDeletemy faculty name is Computer Engineering "Ingegneria Informatica". Other faculties of Politecnico di Milano are mechanical engineering, electronic engineering, chemical engineering. We are engineers in the sense that this is not a computer science course: we are required to know physics (thermodynamics, waves, dynamics, electromagnetism) and high-level math (multiple variable calculus) and we can theoretically switch faculty for the Master degree to any other engineering course.
About the "deterministic universe", the classic physics is deterministic but more modern theories like quantum mechanics aren't and are based on prabability. Heisenberg says for example that no one can know, by principle, both the momentum and the position of an electron with accuracy on both the measures.
http://en.wikipedia.org/wiki/Uncertainty_principle
Of course quantum mechanics it's not required for programming, but that is what I was referring to in the post.
It's may be more accurate for the purpose of this article to say that the world is not *predictably* deterministic. The weather may (or may not) be deterministic, but you still have to treat it as though it weren't, because you can't usefully predict it with 100% accuracy.
ReplyDeleteI would elevate at least elementary statistics to the "must have" level, though. No one can make a reasonable judgment about things like how much effort it's worth putting into covering unlikely corner cases without understanding what "unlikely" means, or how 2 "unlikely"s combine into an overall probability of disaster.
I've been a successful programmer for 15 years. I've spent years working at one of the largest Internet companies, and have launched successful start-ups, including my own.
ReplyDeleteNot once have I needed to know any math beyond basic algebra.
There are plenty of programming jobs out there that you don't need a lick of math to do well.
Here's a question: did you *learn* any math past basic algebra?
ReplyDeleteIf so, I can say almost categorically that your programming benefited from it.
Almost no one needs the actual exact stuff they teach in most math classes. It's the *skills* you learn *while* you're taking the math class that apply strongly to programming, and I defy you to separate them out.
Dude, the more you know about math, the better. Haven't you seen that guy from Numb3rs?
ReplyDeleteSeriously, math is good for you because it develops many different problem solving skills. Besides, it makes an impression if you want to show off in a cocktail party.
What do you need to know as a programmer depends very much on the industry you are in. For example, if you want to land a job in the finance industry (besides UI developer) you should have a solid foundation in calculus (yes, multi-variable too), diff. equations, linear algebra, probability and numerical analysis. And this is just for a starter. Oh, and of course, you have to be a kick ass problem solver.
Regards,
I think that learning specific maths certainly doesn't define how good you are at programming, but the ability to learn and implement maths does. Maths in code sure isn't exactly maths in programming.
ReplyDeleteI'm in high school, and I've never been the best at maths, and never cared for it. Yet I'm learning about Vectors, Matrices, and more maths related knowledge through 3d programming, and programming in general.
Not because of my great maths 'skills', but because I want to learn it. And besides, the only real math I learnt was enough only to implement and work with it, not to know everything and master the subject. So I don't really think knowing maths is as major in programming as many think.
After 25 years in programing I've start to help guys who struggle with programming at school. What I've found is that the better one know math the easy it is for him to learn the abstractions involved in programming (i.e. program variables are very similar to algebra variables).
ReplyDeleteEven a simple loop over an array could be a wall for a non math mind. I'm just talking about speed of learning because I don't know how deep they will gets into the programming after my lessons.
IMHO:
Pre-calculus skills are enough, but must be solid skills. Set theory helps.
Mastering proofs by induction would be the definitive skill, but is very unusual to find in guys.
PS. sorry to all douches for my poor english.
I think knowing math helps a lot in programming. By 'help', I do not mean it’s applicable only to jobs that involve fleshing out complex algorithms in code; but also, it improves how one attends to details, the way one approaches problems, designing (where the capability to abstract things is essential) and increases mental stamina. That said, I should probably also add that there are a lot of jobs out there where you can possibly do without knowing much math (or any math at all)- you work on a few projects: you get to know the nuts and bolts of stuffs - but I still believe , knowing math, would help you there too. After all, doing math is not just about blind symbolic manipulation - that’s just a manifestation :) - its mostly about elegant problem solving, which one might apply to all walks of life.
ReplyDeleteSomeone mentioned 'outsourcing' in a comment - I am not sure about the intended objective or what vein it was mentioned in - but I don’t think that the fact a project has been outsourced to you is reflective of the fact that you are a good programmer. Outsourcing is a business decision - and it could probably mean you are providing cheap labor for a tolerable level of quality (this is not about the commenter :), just mentioning what an outsourcing decision could mean in the worst case :) ).
I have programmed for both the above kinds of projects - application development (some outsourced) and pure 'academic'-tech codes (AI, search heuristics, text mining etc), with the latter kind of work coming to me later. After working on the second kind of projects, for which I had to read up a lot on math, I did find a significant positive change in my approach to problems of the first kind - even though the second kind of projects were MUCH smaller in scale than the first ones.
I totally agree that for *some* programmers math is essential. Can you guys suggest some books on the topics you've pointed out. Recently I've been investigating a lost of trig and the math is perplexing. Sadly the books are just as bad. Many of the formula are extremely complex
ReplyDeleteMiles,
ReplyDeletemany of my books are written in Italian so I think they do not interest you. :)
Apart from trigonometry, which you need a specifical text for, if you want some general insights I would suggest "What Is Mathematics? An Elementary Approach to Ideas and Methods" from Courant and Robbins. My high school teacher suggested it to me when I was 14 and still today I find me thinking "That was explained in the book" after a lecture.
All you need to be a programmer is Be Prepared To Learn New Stuff. This is certainly true in my case. I graduated in History with F*** ALL science background but have been working as a programmer for last 5 years started with C, C++ now working on C#.
ReplyDeleteHere's the thing, if you code simple tasks, then you're not going to need much math.
ReplyDeleteBut when you start analyzing real problems, math is essential.
True cost effective performance testing is nearly impossible without a basic background in statistics. How much is that caching system you put in really helping? How do 2 servers really compare?
Linear Algebra and Discrete math help a lot in search problems (similarity ranking algorithms anyone?).
Graph and Network theory can help out when analyzing how to execute that simulation program, the civil engineer gave you, on a 100+ node computer grid system.
Differential Equations and Linear Algebra would be helpful in actually understanding that engineer's code.
Don't forget about physics! Important if you want to do game programming...(e.g. realistic models) =P
ReplyDeleteThe thing about physics is that it's only relevant in the sense that certain specific fields actually use knowledge from that field.
ReplyDeleteSort of like how genetics is good to know if you plan on working in the bioinformatics field (as it math :-).
The difference with math is that the *process* of learning how to solve complex math problems and construct airtight proofs aids you in *all* analyses of even moderately complicated algorithmic problems you might run into.
Programming is a generalist's art. The more you know about more fields the better you will do overall. Mathematics provides practice and learning about algorithms that cuts across multiple fields.
In it's own way, it's also an important generalist's skill, as many difference fields make use of math. But that's secondary.
I didn't take the high school math exam and went to the crappiest university to study CS, which didn't even need a math or any real subject exam, to get in (like WTF, right?). We had linear algebra and discrete math, and something else. I somehow got through the exams, but i still don't understand much of it, i understand set theory, boolean logic and some of the basic stuff. Result - i'm creating user interfaces at a company, which creates software for online bookmakers. Other developers are having fun with modelling different markets for different sports, doing function analysis, probabilities, statistics etc. I can't take this crap anymore, though the pay is good, i just started my masters in a better university and i'm gonna take math courses again, cause a high school kid could do my job. It's f*****g frustrating. So, if you suck at math, no one will give you more responsible, interesting tasks. They'll just throw you in the GUI department. Eventually you will get bored, which i am right now. And if you're bored, you become less productive and start hating your job. I'm on that path. But there's a plus side. Since i was really, really BAD at math at high school, i didn't understand what a hell a function is, what integers or real numbers are. But now that i've learned to use functions and methods in programming, using java, i actually understand what a function is now, that it has input and ouput - so easy. I associate terms integers and real numbers, i know what they're called now, in high school it was a big confusion, teachers using these "complicated" terms to sound smart or whatever. So programming in my case has brought me closer to understanding math and associate difficult terms with simple concepts. I've been learning high school math independently, it's so easy now, since I can relate it with my programming experience and the simplest logic. I blame the educational system, if a teacher uses unknown terms in sentences at a high frequency, and doesn't properly explain them, then anyone would lose interest and wouldn't want to deal with it. When in fact you're dealing with very simple concepts. And of couse the greek letters scare the hell out of anyone. I like the american education system, it tries to always bring examples in real life and explain the terms, it makes so much more sence in the way of teaching. I'm from Eastern Europe by the way, people here like to brag with their knowledge and scare the crap out of the younger generations. I'm still dumb at math, but i'm getting there. If i can take all the math courses in masters and understand it, i'm probably gonna go to doctorate also :)
ReplyDelete