Which Math For Programmers?
An anonymous reader writes "It is no news that the greatest computer scientists and programmers are/were mathematicians. As a kid 'hacking' if-else programs, I was not aware of the importance of math in programming, but few years later, when I read Engines of Logic by Martin Davis I started becoming increasingly more convinced of this. Unfortunately, math doesn't return my love, and prefers me to struggle with it. Now, as the end of the semester approaches, I am faced with a dilemma: What math subject to choose next? I have two choices: 'Discreet structures with graph theory' (discrete math; proofs, sets, algorithms and graphs) on one side, and 'Selected math chapters' (math analysis; vectors, euclidean space, differentials) on the other. I'm scared of the second one because it's said to be harder. But contrary to my own opinion, one assistant told me that it would be more useful for a programmer compared to the first subject. Then again, he's not a programmer. That's why I turn to you for help, fellow slashdotters — any advice?"
I don't disagree that mathematicians make great software engineers, but I think most of the great software engineers in the past were physicists and electrical engineers.
It is no news that the greatest computer scientists and programmers are/were mathematicians.
I caution you that there are many other science professions which require math to varying degrees. The above statement could also be true of phycisists, chemists and maybe even biologists. The vectors, proof and algorithms that math provides a foundation to (or is) can be compared to the statistics that a biologist relies on or more generally processing empirical data in any science. We teach our kids basic math so they understand home loans and taxation later in life. Similarly, your best x in any science related field will likely have strong math skills to take what gets thrown at them.
I have two choices: 'Discreet structures with graph theory' (discrete math; proofs, sets, algorithms and graphs) on one side, and 'Selected math chapters' (math analysis; vectors, euclidean space, differentials) on the other. I'm scared of the second one because it's said to be harder. But contrary to my own opinion, one assistant told me that it would be more useful for a programmer compared to the first subject. Then again, he's not a programmer.
But he's definitely correct. The second is going to give you practical skills in programming -- a wide array of practical skills. The first is most likely going to give you some automata theory for computers but unless you're going into theoretical research, the second is the obvious answer. Graphics and games are all vectors, the web is becoming even more so with new browser rendering technologies. Rendering is all euclidean space transposed onto a two dimensional plane (screen) using points (pixels). Differentials are huge in the vision and image processing world and again, in graphics. This is your obvious selection although I challenge you to take both. Also, look for courses on classes that blur the lines between stats/math and computer science. Like courses on error correcting codes or computer language design and theory.
I don't know about you but I would rather take a seriously difficult course and learn a lot with a grade of C+ than take a seriously easy course and learn little with a grade of A+.
Unfortunately, math doesn't return my love, and prefers me to struggle with it.
As a brief aside, it's entirely possible you simply were never exposed to fun math or been exposed to a really influential teacher. It will not give you the joy that primary school math league gave me nor will it be a perfect substitute but Martin Gardner has some really fun math. While this won't get you excited about graph theory and linear equations, it might spark something in you to devour math regardless of how dry it is. Talking about quadratic sieves in regards to finding primes is really boring stuff when it's a paper full of symbols. But if you know what kind of power this holds in regards to cryptography, one can get really zealous about it. Remember to help your kids with this should you decide to procreate.
Also if you haven't read Godel, Escher, Bach, it might be time. Copies of those sell for cheap used online.
My work here is dung.
Take Both. Make time for it.
Programming is a HUGE field. There is plenty of work that doesn't require significant math.
Go with what interests you and let the details work themselves out.
When information is power, privacy is freedom.
anything its to take business math. It has to take some amazing math to turn - X billion in profits into +xx million in bonuses.
I believe that my courses on Set Theory (aside from the obvious basic maths like Calculus and Differential Equations) have been the most useful to me as a programmer. It looks like 'Discrete Structures with Graph Theory' may be the way to go, but I recommend taking as much math as you can. Like an earlier comment stated, "Make time for it".
Venn Diagrams. Intersection. Union. AND/OR/NAND/NOR
I constantly run into people screwing stuff up because they get lost in the logic of stuff like "if this is part of that group but not contained in this set".
I want to delete my account but Slashdot doesn't allow it.
If you struggle with math, I would definitely take the discrete structures class, not the second class. 3D Vector Calculus (e.g. Maxwell's equations) was one of the toughest subjects I've ever taken, and guess what -- I've never used it since! Set theory, on the other hand, is used constantly in CS; in fact, boolean algebra is just a subset of set theory, and I believe Relational Databases are built on top of set theory.
I've abandoned my search for truth; now I'm just looking for some useful delusions.
Set theory and graph theory come in handing when programming.
Some variation of the "traveling salesman" problem, a graphing problem, shows up in every industry out there so it would be a good idea to be familiar with its nuances and the various approaches to getting it mostly right (i don't think it has been solved).
Set theory is a good place to start thinking about just about anything. You'll probably also cover combinatorics, formal logic, and predicate calculas along with set theory which are also great tools to have when programming.
I came to the datacenter drunk with a fake ID, don't you want to be just like me?
Same as me, well almost. I was a math major and before that I was a computer science major, so I have both. Unless you are working on a latest game engine in a video game company, chances are you will be using set/group theory more from your first class. I speak of experience, I actually work in one of the top 3 video game companies in the world and yet I am using more "math" from the discrete branch than the calculus branch. But yea, do both as someone else said, I am glad I did.
Tired of my customary (Score:1)
I'd strongly recommend going with choice #1. There's a huge amount of application of graph theory, etc. in both computer science and in practical programming.
My undergrad degree is in Math, and I have -never- used anything I learned in the classical mathematic topics past linear algebra. The courses in statistics and probability, and the 2 Operations Research courses (I was very lucky to get both of them) have been the really useful items. Unfortunately I was unable to take the graph theory course, but I bought the book anyway.
In conversations with my Alma Mater, they have substantially changed their curriculum, moving away from the classical analysis topics and more into discrete math.
Do the Algebra/Logic first, it is more directly applicable to computing and will allow you to understand undecidability (Goedel) computability (Turing) and of course graphs, groups and algebras. Also modern approaches to what people call Calculus, ie diferentialability etc are much more algebraic in the arena mathematicians call Analysis. Read Don Knuth's Fundamental Algorithms in parallel
You could take an entire math degree and still not have enough math to be a decent computer scientist (being a programmer is another matter, I suppose). Discrete math (or at least I hope you meant to say "discrete". "Discreet" math would be much less useful) is extremely useful for all areas of computer science. Analysis is extremely useful for a lot of areas of computer science, but I don't think as comprehensively as discrete math.
Programming is about algorithms. Proving them, or better yet, deriving them (you may find deriving is a lot easier than proving, I did). Graphs may come into play, but that depends on your particular interest, they do give a great insight into complexity though. Knowledge of sets is extremely useful.
To me the first looks absolutely essential for a computer scientist. The second is nice if your interest lies in that direction, but it doesn't have anything to do with programming in general (it does seem essential for a mathematician though).
My advice: Learn Logic rather than math. It is far more useful.
Or at least remove it from RSS? I swear, it feels like half the "news" that comes through the RSS are these banal, you should have asked them on a forum, questions. I pay attention to slashdot for the news, for the things that you see here first, not this banal "gee, I have a question that I really should have asked on a niche message board" chatter. At the very least, would it be possible to simply do an RSS feed WITHOUT the ask slashdot waste of time so that my RSS reader isn't constantly warning me of "news" that is simply a waste of time?
You should probably take both of these courses: requirements aside, both are important for a truly solid CS education.
Take Discrete Structures first, especially since it has graph theory rolled into it. This will be more directly applicable to your CS coursework as discrete math and graph theory pop up EVERYWHERE, and when you get out into the real world you'll benefit from a solid understanding of these concepts.
Math Analysis will be useful too, as will the linear algebra components that seem to be buried in that class somewhere.
As others have said, make sure you get a good professor. Sit in on a lecture if they'll let you. A dull, droning, Ben Stein type teaching either of those courses will cure your insomnia, but your GPA will suffer.
Final word of wisdom: Do not take the advice of a random (non-CS) teaching assistant, "general" academic advisor, or (ESPECIALLY) Slashdot. They're idiots (even me). Talk to other students, professors in your department or your major advisor for course order recommendations.
/~mikeg
The course I took was a senior-level course but any high school student who did well in high school algebra and who has the brains to do well in Calculus can understand it.
My course in a nutshell:
Integer math with wrap-around. Think clocks, where the minutes start at 0, go to 59, and wrap around to 0 again. 30+30=0, 2-10=52, 5*12=0. You learned what a field and a ring are.
I wish I'd had this in high school or as an underclassman.
I doubt your college will let you substitute this, but if they do, go for it.
As for the two options you have:
For logic-type programming in any application that doesn't deal in continuous or analog-like data, 'Discreet structures with graph theory' will do you better. If you will be spending your life handling "analog"-like data, 'Selected math chapters' will do you better. If you were going to be a math major or enjoyed math, I would say take both.
... you have will have to break through that wall at some point.
Maths is not a memory-based subject - you have to build the manipulation skills that Math requires. The only way to acquire that ability is to keep doing the maths problems until they start to click. You need to build a set of tricks to change problems from ones you don't recognize into ones you do. Be prepared to grind it out. Find a set of problems that increase in difficulty and hack at them until they make complete sense. Don't rush and don't attempt to do them all at once.
You also need to find some Math tasks that are fun or interest you. If you are learning about complex numbers, go look up some fractals and look at the formulas. Picks some starting values and play with the numbers. Get a sense of how the numbers move around and a firm underpinning about what is going on. If you are doing calculus, play with the equations of motion and work out what a canon ball does under constant acceleration. Try modelling a N-body system of planets moving around in 2D on a computer. All the time, you will be building an internal model about the way that all this hangs together.
Maths can be extremely rewarding once you grok it. But if you don't get past the struggle phase, it will never give you any pleasure and you'll miss out.
Cheers,
Toby Haynes
Anything I post is strictly my own thoughts and doesn't necessarily have anything to do with the opinions of IBM.
If you're writing GUI programs, implementing business logic, accessing databases, and doing many of the workaday tasks of the grunts of the technology world, you don't need much math. Plenty of people have become very good professional developers with neither a degree in math or computer science.
However, mathy programming is (to some people) more fun, and if you angle yourself correctly, it's harder and a more rare skill set, so you can get more money. Knowing math is also pretty important if you want to become a professor of computer science, which if you care more about vacation time and benefits than salary, is one of the sweetest gigs going.
Combinatorics, probability, linear algebra, and graph theory are probably the most applicable to the widest range of problems. I'd put combinatorics at the top of the list, since it's going to be used to figure out the time and space complexity of any complicated data structure or algorithm. If you want to do anything with peer to peer software or networking, then graph theory is more or less essential. Linear algebra is all over any simulation of physics (games, control software for vehicles, pretty much anything with some sort of sensor or motor) as well as finance (there is mad money in financial computing, not as much as two years ago, but still a lot). Probability is good for figuring out things like hash collisions, average performance of algorithms.
Number theory is used almost exclusively for crytography. Which is an awesome thing to work with. The NSA has a lot of good jobs if you're cool with that morally.
If it was 30 years ago and more programming jobs required the actual manipulation of 1s and 0s, then boolean algebra and discrete math would be at the top of the list. They still do if you want to work with embedded systems, compilers, or anything under the umbrella of EE/CS.
Numerical computing (like if you wanted to build MATLAB) uses all sorts of math, and I'm sure there's someone somewhere simulating quantum physics who's up to their neck in Abstract Algebra (which is a fascinating subject if you've got the stomach for some tough proofs)
There's probably not much undergraduate math that ISN'T useful for writing code in some problem domain or another.
If you want a good book on the kind of very useful computer math that isn't taught to undergrads nearly enough, check out Hacker's Delight by Henry Warren. It's a beautiful little book that will come in very handy if you ever need to write efficient C or assembly. And if you dig it then dive into the insanity mandala that is Donald Knuth's The Art of Computer Programming.
In Capitalist America, bank robs you!
The programmers I know who do serious math, such as very complex DSP algorithms, game programming, complex statistics analysis, etc. get paid a fraction of what a I do for business/consumer web apps. That's not to say there aren't some brilliant folks out there getting paid a lot of money to do complex mathematical program, but they seem to be the exception, not the rule. Most of my work tends to be logic monkey stuff. Algebra I and II would cover it the stuff I do. I say current with tech, know how to talk to business folks, and get paid very well for my services.
Even when I do things like insurance rating and underwriting application; the Actuary has already done the hard math and distilled it into a fairly very simple table of rating factors that are handled using simple arithmetic.
It's kind'a sad to see Advanced Math only pays for a small percentage of programmers.
Math isn't just "learned". It is "practiced". Much in the same way that you don't just "learn" to throw a 90mph fastball, you don't just "learn" to do math. Math is a set of techniques, combined with skill that must be developed.
A large part of math, especially that done in high school and college, is just exercise for the brain. There may be some practical application in the future, but the vast majority of people will never have a need to take a derivative any more than they will have the need to throw a 90mph fastball.
What they will have a need for, is the mental capacity to think methodically, logically, and mechanically about a problem. I cringed when my son's college writing professor said that "Luckily, journalists don't have a big need for math." That sort of braindead mindset is why we have reporters not bothering to question how federal healthcare will ever save money in the US. Journalist are not trained to wrap their minds around logical concepts like "If A=B, and B=C, then A=C". Those neurons have not been exercised.
The goal of taking the math class is not necessarily to learn a specific set of mathematical techniques. It is as much about developing the mental capacity as anything else. When you start developing, it will be very difficult to cope if you haven't developed those mental muscles.
Aah, change is good. -- Rafiki
Yeah, but it ain't easy. -- Simba
This This is a gross simplification, but there are sort of two kinds of math. There's logic math, and there's numbers math. It sounds like the the two courses roughly divide according to this line. When most people hear math they generally think of numbers math.
If you are a programmer then you do already love the first kind of math, and it does love you back. It's the second kind of math, the ugly numbers math, that scares you.
Math is not merely "important in programming", programming literally is a specialized form of math. Most people don't realize programming is math because because people think of "numbers math" when they hear the word math. Everything software is and everything software does is "logic math". The math of manipulating complex information, the math of manipulating complex logic relationships.
The math of manipulating data.
'Discreet structures with graph theory' (discrete math; proofs, sets, algorithms and graphs)
Programming extensively uses sets, discrete math, and graphs to organize data, to understand data, to manipulate data. A program is literally nothing more than one big algorithm built up out of several smaller algorithms. And in a deep sense, programs and proofs are the exact same thing. There is a math proof that every program can be directly translated into a proof, and every proof can be translated into a program. They are fundamentally identical things with identical logic and identical properties. Reading proofs and writing proofs uses the same precise step-wise logical analysis as reading and writing software.
This course is the math that is the very essence of programming. It's the sort of math and logic that you already you already use every day as a programmer without realizing that it is math - the sort of math you *will* use every day in the future as a programmer. The insights and logic skills in this course will directly advance your every day skills and capabilities as a programmer.
'Selected math chapters' (math analysis; vectors, euclidean space, differentials)
There are things that can be useful *in* a program, but they are not really useful *to* programming. For example if you want to handle or simulate physics-systems, falling rotating moving objects, manipulating 3D objects and graphics, then vectors acre extremely important, along with good intuitive spacial skills. The math analysis and differentials are generally even more rare and specialized. Computers are fantastic at handling that sort of stuff, and sometimes you really need an advanced math-programmer to do literal "rocket science" aerodynamics and orbital mechanics, but most programmers will never need to touch the stuff. You don't need scary-math analysis or differential equations to program an operating system or a webserver or any normal business application.
If you're not doing that sort of sciency-math programming, then you'll never use that stuff. If you're not working on that stuff but you do come across a case where you need to pull in a small piece of that stuff, you can usually just copy-patse in the ugly equation you need even if you don't have any grasp of the math behind it.
The biggest issue there is if you want to do 3D graphics manipulations. A lot of those math equations can be copy-pasted in semi-blindly, but you will seriously choke on that sort of work unless you are good with vectors and have a good intuitive spacial skills.
So in short you definitely want to take the 'Discreet structures with graph theory' course. It will make you a better programmer. The other course merely allows you to specialize as a mathy-sciency-programmer. Take both if you're up for it, but that sort of mathematical programming is not everyone's cup of tea. You can get by fine without it.
one assistant told me that it would be more useful for a programmer compared to the first subject. Then again, he's not a programmer.
Exactly - he's not a programmer.
He sees the course expanding your ability to write programs
- - You can't take something off the Internet! That's like trying to take pee out of a swimming pool.
"...then hand over their work to skilled software engineers that are qualified to turn it into good software."
As a physicist I only have to look at the code we use and write to see your initial point (try looking at ROOT from CERN for C++ that will make you want to cry!). However your solution simply does not work. You cannot "hand it over" to a non-expert in the area because the usage and purpose of the code is something that they do not understand and so the result will be unusable (there was one program I remember as a grad student which was a beautiful design but the overhead was so large that one senior physicist calculated that he would be retired before it had finished one pass through the data!). The best scientific code I have seen is generally written by an expert in the field who has experience of good software design. Even close collaboration between physicists and software engineers rarely works because neither side is willing to compromise functionality for design or vice versa.