Slashdot Mirror


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?"

29 of 466 comments (clear)

  1. Physicists? by jeffblevins · · Score: 5, Insightful

    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.

    1. Re:Physicists? by rrhal · · Score: 4, Insightful

      In the US many (if not most) CS departments were affiliated with the Math department. There was a movement after I graduated (1982) to move CS departments to the engineering schools because there was more government funding for engineering. Math intersects programming in two ways: both programs and proofs benefit from a certain logical approach that can be learned in classes like abstract algebra and advanced calculus; numerical methods for solving integrals, differential equations, and linear algebra. The first helps with logically setting out a program. Minds are lazy; we all tend to believe "hand waving" rather than work out all the nitty gritty details. Learning mathematical proofs will help you recognize when you are hand waving and when you have really nailed things down. The second is a specialty for the sciences. There are a lot of good things to know about the pitfalls of numerical calculations on computers.

      --
      All generalizations are false, including this one. Mark Twain
    2. Re:Physicists? by COMON$ · · Score: 5, Insightful
      I know you are trolling but I call BS here (pun intended). I have a CS degree and am a Network Admin in an IT department. Now while I am not spending my time doing research (what you are referring to). I am using CS theories and applications every day. Tools are tools, whether I am using someones algorithm for optimizing data at a low level or high level either way I am doing data optimization. Given there are a LOT of IT folk out there, A LOT, that dont think of the profession properly. (See parent post, they may just not know that they are using high level math or may not be that good of an IT person) There are plenty of us CS grads who do. I have fun with numbers all the time, figuring out the rate of change in our systems over the last 5 years or calculating projected resource needs in 3 years.When I am looking for a solution to a problem I am not thinking vendors, I am thinking, what are my parameters and how do I fit them? I use my knowledge of big Oh for figuring out which methods to use for intrusion detection, or for designing routes on networks. I use my knowledge of numerical analysis to figure out how close is good enough when determining efficiency.

      We could go all day on this but tools are tools, objects are objects, it doesn't matter if they are arrays or VB scripts. Either way we are standing on someone else's shoulders and using computational analysis to find a solution to a given scenario. Do I really need to whip out the XKCD reference here?

      --
      CS: It is all sink or swim...oh and did I mention there are sharks in that water?
    3. Re:Physicists? by bughunter · · Score: 4, Interesting

      I think you're confusing the art of programming with the engineering of software systems. The minds that are good at one are generally not good at the other, and training for one often comes at the expense of the other. Very few are good at both, though I have worked with such people. The former requires an intimate understanding of the science and mathematics underlying problems to be solved, whether they are actuarial algorithms for life insurance or physical engines for FPS video games. Physics and math are the foundation upon which the necessary intuitive, creative leaps can be made to solve problems in a robust, elegant manner. Turning the crank on an existing process isn't good enough. The latter is fundamentally systems engineering: identifying and quantifying assumptions, risks, and resource limits; chunking problems and deriving requirements; and lots and lots of bookkeeping and documentation. The bookkeeping and documentation parts are the kinds of things that many physicists and electrical engineers have to be cajoled and browbeaten into. Software engineering can seem very, very tedious to a creative mind. Now, which did the GP mean? I think the former. But I think you are talking about the latter, and you are both correct.

      --
      I can see the fnords!
    4. Re:Physicists? by treeves · · Score: 4, Informative

      Pharmacists arent Chemists

      In the UK they are called that.

      --
      ...the future crusty old bastards are already drinking the Kool-Aid.
    5. Re:Physicists? by Jahava · · Score: 4, Insightful
      While you are trained in Computer Science and are actively applying Computer Science to your job, you are not working as a Computer Scientist.

      You are working as a network administrator. Like any field, network administration benefits from knowledge of other fields. In your case, you are using your knowledge and training in Computer Science, Mathematics, and (I'm sure) other fields to your current problem, and it's better off for it. You are practically applying scientific fields.

      Most of the work I did while working on my Computer Science degree was on textbook and paper. Computers were occasionally used for mock-ups and proofs of concept, but most of the lessons that I learned were pure theory. Think about that ... you don't need computers to practice Computer Science (and, indeed, the early forefathers of the field didn't even have them).

      Sadly, the majority of CS majors end up getting jobs in IT, network administration, etc. This because there are way more jobs building things than there are researching them. CS people are often sought out for those jobs because their CS training is very applicable to the work (as you so clearly demonstrated). However, don't fool yourself. Even if your job title reads "Computer Scientist", most corporations see that as analogous to "guy who knows how to use a computer". Computer Science is all about the theory.

      If you're reading this as some sort of elitism, you're reading it incorrectly. It's an important technical distinction, and one that is becoming more apparent as the field matures and Computer Science ascends towards the HTW just as Information Technology drifts towards Engineering.

  2. The Second, If Not Both by eldavojohn · · Score: 5, Insightful

    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.
    1. Re:The Second, If Not Both by VAXcat · · Score: 5, Insightful

      I took years and years of vector & euclidean math, differential euqations and the like. Mow after working as a programmer for a very long time, I've used data structures, graphs, algorithms and the like on a daily basis. I've used the other, "Buck Rogers" math...once. I realize this is anecdotal, but I can't see how most programmers would have more use for the advanced analysis style math over the discrete stuff. Gradients, divergences, curls, triple integrals and partial differential equations are a lot of fun, but they just don't come up that often unless you're a physicist or a games developer.

      --
      There is no God, and Dirac is his prophet.
    2. Re:The Second, If Not Both by DeadDecoy · · Score: 5, Interesting

      As a programmer, I've found statistics to be another useful branch of mathematics. It can be more functional when collaborating with others to do number crunching and can having varying degrees of difficulty from drop-dead-easy to omgwtfbbq. Also, probability and statistics in general, are often incorporated in machine learning to make the computer handle non-deterministic problems; good for programming AIs and such. Personally, I always liked learning the 'harder' thing as that might expose my brain to concepts or ways of thinking that I wasn't already familiar with. But regardless, math isn't too bad if you take the time and effort to understand it.

    3. Re:The Second, If Not Both by rochberg · · Score: 5, Interesting

      [...] 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[...]

      I couldn't disagree more. There is no "obvious selection," because the OP didn't mention what type of programming interests him. If you're going to specialize in graphics or scientific computing, yes, the analysis course would be helpful. However, I find that branch of mathematics completely useless for the programming work that I do.

      In more systems-oriented programming (e.g., OS, compilers, networking, databases), a strong background in algorithms, data structures, and graph theory is absolutely essential. If you start moving into security and cryptography, you need to understand modern algreba topics like number theory and group theory; having a solid foundation in set theory is a prerequisite for any of those topics.

      [...] although I challenge you to take both [emph. added]. 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.

      On this point, we agree.

    4. Re:The Second, If Not Both by samkass · · Score: 5, Insightful

      If you're going to choose and not do both, then it largely depends on what kind of "programming" you're going to do. Note that "Programming" is a very different profession from Computer Science or Software Engineering. If you're interested in 3D, games, physics, etc., you're going to need a solid foundation in linear algebra and calculus. If you're going to be dealing in large datasets, distributed systems, client-server communications, etc., then discrete math and set theory will probably be very useful. If you're going to go into AI, classifiers, robotics, etc., then you'll probably want both, plus statistics.

      If you're just going to bang out code to someone else's careful spec, then you may not need all that much math.

      --
      E pluribus unum
    5. Re:The Second, If Not Both by Bakkster · · Score: 5, Insightful

      Agreed. Discrete math is vital groundwork for a lot of what is expected from a programmer, while the second course seems more focused but less generally applicable. Basically, if you take discrete you will learn how to find your own solutions to an array of problems through logic, set theory, combinatorics, and algorithms; while the second course will basically teach you a few concepts used in 3D graphics and physics modeling. Unless you absolutely know you want to work in a field that would heavily use the second course, take discrete. However, even if you take the 'selected chapters' course, I think you would have difficulties doing much useful with vector math or calculus without knowing discrete math to turn it into an effective and efficient algorithm.

      To be truly successful, though, you should take both, even if you take one pass/fail or not for credit. The information is just too important not to have.

      --
      Write your representatives! Repeal the 2nd Law of Thermodynamics!
    6. Re:The Second, If Not Both by beelsebob · · Score: 5, Informative

      I 100% disagree with this post.

      Almost *any* complex algorithmic task (programming) comes in the end, down to solving *some* graph theory problem. The first one most definitely sounds more useful to a programmer. This has applications in coming up with algorithms, understanding type systems, proving to some degree that your program works, understanding the logic involved in your program. Sets and graphs are about the most important structures you will ever come across in programming.

      The latter is pretty much only useful for people building 3D tools, to which the former is also applicable.

    7. Re:The Second, If Not Both by BlueTrin · · Score: 4, Insightful

      Even if you work in Finance IT, having a math background allows you to move into much more lucrative jobs where you will implement fairly complex methodologies. You can look for quantitative developers job specs, they will require you to have a fairly above average math background compared to your average IT dude.

      --
      Don't you know it is now both immoral and criminal to think beyond the next quarterly report?
    8. Re:The Second, If Not Both by TheRaven64 · · Score: 4, Insightful
      Absolutely agreed. Discrete maths is fundamental to computer science. Between graph theory, set theory, and game theory, you've got 90% of computer science.

      The other stuff will be useful in some situations, but it's domain-specific knowledge, not foundational knowledge. It's useful, but so are other domain-specific skills. If you want to understand computer science, you need the discrete maths. If you want to be useful, you need to understand computer science and some other stuff. This may include vector and matrix mathematics, but it may not. I've very rarely used the calculus or matrix stuff that I know, but I use the graph theory almost every day.

      --
      I am TheRaven on Soylent News
  3. Study what you enjoy by Jah-Wren+Ryel · · Score: 4, Insightful

    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.
    1. Re:Study what you enjoy by boner · · Score: 4, Insightful

      I second that, study what you enjoy and see where your interest takes you. I struggled with statistics when I studied for my masters, but my current job is steep in statistics and I am much better at it. Funny how that goes.... It's a lot easier to learn a Math subject when there is a real need to understand it present, otherwise it can remain abstract and obtuse.

      The other piece of advice: do your homework, everyday, and don't give up. Seriously, I was a B+ student until my math teacher started checking my homework - I told him that there were other students more deserving of his attention. Within a few weeks I was an A-student...

      As for making a choice, I would do both, but take the easier one first.

    2. Re:Study what you enjoy by Carewolf · · Score: 5, Informative

      True not all fields require math, but just to answer the question. Yes, choose what you like:

      If you want to do algorithms and language theory, you need discrete math, graph theory, etc.
      If you want to do graphics and signal processing, you need calculus (also called math analysis), geometry and differential.
      If you want to do human computer interface, you don't need math (or a brain).

      If you want to kick ass, you need all the introductory math you put your hands on (advanced university level math is too theoretical though and only useful for quantum physics and math majors).

    3. Re:Study what you enjoy by TheRaven64 · · Score: 5, Insightful

      If you want to do human computer interface, you don't need math (or a brain).

      Absolutely untrue. You need statistics, graph theory, game theory, and a little calculus. At an absolute minimum.

      Attitudes like yours are why so many user interfaces are terrible.

      --
      I am TheRaven on Soylent News
  4. That depends on you... by geminidomino · · Score: 5, Interesting

    If you're just worried about the programming (coding and maybe some design) side of things, then the math you need is going to be the math that applies to what you're coding (calculus for physics engines, algebra for accounting packages, statistics for reporting ,etc...).

    On the other hand, if you think it will benefit you to know more about what underlies the code (it does me, but we may think in different ways), then I would say absolutely that you should take the Discrete. Computer Science is 95% applied Discrete Mathematics. Computer Science is also a lot of theory which, truth be told, tends to be very specialized in usage to developers unless they're going to the very low levels. After taking DM for my degree, I found that my code has improved, but I also admit that it is anecdotal.

  5. I was a math major, work as software engineer now by jockeys · · Score: 5, Informative

    and pretty much the only math I use on a daily basis (when writing code and designing software) is the discrete math. (I did take both classes when I was in school, and lots more besides) so, in my experience the first course would be much more useful.

    --

    In Soviet Russia jokes are formulaic and decidedly non-humorous.
  6. Set Theory / Boolean Logic by Gothmolly · · Score: 5, Insightful

    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.
  7. take Discreet by trybywrench · · Score: 4, Insightful

    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?
  8. Discrete, NA, then PDE by Dr_Art · · Score: 5, Interesting

    Take the Discrete Math stuff first since you are just beginning to learn Computer Science and it will fit better with those courses. You should then take Numerical Analysis to totally break your concepts that computers are precise. Finally, take the classical Calculus & Differential Equations track just so you can take Partial Differential Equations, at which point the math will start becoming useful for real world Engineering problems.

  9. Agebra... by RingDev · · Score: 5, Interesting

    Proofs, proofs, then more proofs.

    Programming is all about isolating the smallest part of a problem and simplifying it out. Doing proofs is effectively the basis for programming.

    Understanding trig and calc is handy for specific projects, but for every single program we write we have to be able to see the problem, to isolate components of the problem, and to simplify them.

    -Rick

    --
    "Most people in the U.S. wouldn't know they live in a tyrannical state if it walked up and grabbed their junk." - MyFirs
  10. Quick lesson in business math by ShatteredArm · · Score: 4, Informative

    This is actually quite simple. The trick is to recognize gains as soon as possible, while waiting as long as possible to write off losses. This is the motivation behind FASB's rule change at the beginning of April 2009 (at the kind...er, suggestion...of the large banks) that allowed any asset marked as "held to maturity" to be valued at whatever they want (so long as it doesn't exceed the maturity value). That means that if 50% of your loan portfolio is delinquent and has no chance of ever accruing, you can put a label on it that says you'll hold it to maturity, and you don't have to recognize a 50% loss in your loan portfolio until 30 years down the road (so long as you don't foreclose on the debtors, of course). By simply waiting on the foreclosures, you can make billions off of free money from the Fed discount window (heck, you can even borrow that money from the Fed at 0%, and loan it right back to the federal government at 3%!), and rake in billions in "profits" (and bonus payouts). And then when your bills come rolling in, it doesn't matter that you have no income and all your assets are worth less than a Pontiac Silverdome... you've already cashed in your stock options. As they say, patience is a virtue!

  11. Two kinds of math by Alsee · · Score: 4, Insightful

    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.
  12. Both skillsets are needed by Roger+W+Moore · · Score: 4, Insightful

    "...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.

    1. Re:Both skillsets are needed by Roger+W+Moore · · Score: 4, Interesting

      It's quite shocking isn't it? And not just a "this code isn't very pretty" problem either, but the instability of the thing is remarkable.

      Remarkable? Its legendary! ROOT has the dubious distinction of including the worst piece of programming I have ever seen. When adding some extract I/O objects in separate header files to a program, generating dictionaries etc. I suddenly had the linker complaining about duplicate symbols. After spending just over a day trying to figure out why and getting more and more confused I finally demonstrated that ADDING A COMMENT to the code fixed the problem!

      Staggered that ROOT was somehow breaking the C++ standard in ways I had not even contemplated I spent another day tracking this down to an automatically named function which used the C preprocessor line number directive as the only variable part of its name. So, if you happened to have the classdef (IIRC) macro on the same line in two header files ROOT would generate identically named symbols. The result was that something as simple as adding or removing a comment could fix or cause a duplicate symbol problem!

      Far, far worse than all that though was that when I submitted a nice bug report illustrating the problem and pointing out the macro which was at fault they claimed that this was NOT A BUG and did not need fixing! ARGH! I only ever use ROOT through the Python interface now since it shields you from so much of the pain....just not all of it unfortunately!