Become a fan of Slashdot on Facebook

 



Forgot your password?
typodupeerror
×
Math Science

Which Math For Programmers? 466

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?"
This discussion has been archived. No new comments can be posted.

Which Math For Programmers?

Comments Filter:
  • Discrete structures (Score:3, Informative)

    by MxTxL ( 307166 ) on Wednesday January 06, 2010 @11:26AM (#30669884)

    This is the fundamental math for computer science. The other is useful for other subjects, some of which will need software... but if you want powerful fundamentals, it's in discrete structures.

  • by jockeys ( 753885 ) on Wednesday January 06, 2010 @11:29AM (#30669938) Journal
    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.
  • embrace the pain (Score:4, Informative)

    by bl8n8r ( 649187 ) on Wednesday January 06, 2010 @11:34AM (#30670036)
    if you don't have a good understanding of algebra and geometry, computer graphics coding is going to suck for you. You will not only find the work daunting, but your coworkers will be very frustrated with the duct tape work-arounds you will need to employ in order to compensate. My advice would be to work your butt off to grok both classes. It will only make your quality of work life more enjoyable later on. Trust me, math hated me as much as I hated it and I've had to go back and do it over.
  • by sab39 ( 10510 ) on Wednesday January 06, 2010 @11:36AM (#30670086) Homepage

    I'm not directly familiar with either course (and the one-word summaries are a bit limited for providing informed advice!) but it sounds to me like the first one would be generally useful and you should take it regardless of what programming you intend to do - it sounds like it covers sort of the "mathematical fundamentals of programming". The second sounds more like it's useful for certain *types* of programming - perhaps 3d or game programming. Unlikely to be terribly useful for writing database-backed web applications, for example.

  • by erikscott ( 1360245 ) on Wednesday January 06, 2010 @11:38AM (#30670114)
    A couple of thoughts -

    The former will be really useful if you decide to work on database-related things. Not just "using SQL to get my work done" but actually crafting the internals of a database. Similarly useful for compilers - both of them have optimizers, and that's just one big graph traversal. Too big to do in a useful amount of time, so all kinds of heuristics are used for graph pruning. Go for it.

    The latter is a good foundation for numerical analysis, a field occupied by a lot of engineers and fairly few CS type people. It's a nice differentiator (pardon the absurdly weak pun). You'd much, much rather try to find simulation work than, say, writing yet another inventory management application these days.

  • by Carewolf ( 581105 ) on Wednesday January 06, 2010 @11:46AM (#30670244) Homepage

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

  • by beelsebob ( 529313 ) on Wednesday January 06, 2010 @12:07PM (#30670598)

    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.

  • Re:Physicists? (Score:4, Informative)

    by arethuza ( 737069 ) on Wednesday January 06, 2010 @12:07PM (#30670600)
    I don't know about that - the CS degree I did (starting in '83) was in a Computer Science department that was opened in '67. While I think that was one of the first in the UK I don't think it was that exceptional.
  • by ShatteredArm ( 1123533 ) on Wednesday January 06, 2010 @12:12PM (#30670676)
    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!
  • by Anonymous Coward on Wednesday January 06, 2010 @12:16PM (#30670774)

    Then you've never sat down and thought about what it takes to make a 3D environment and get perspectives right.

  • Re:Physicists? (Score:4, Informative)

    by John Betonschaar ( 178617 ) on Wednesday January 06, 2010 @12:38PM (#30671092)

    Dude, if there's three kinds of people on earth that make terrible software engineers, they're mathematicians, physicists and electrical engineers.

    While they may write incredibly smart and efficient computer programs that solve incredibly difficult problems, that doesn't make them good software engineers. The libraries and API's I've used that have the worst documentation, the worst programmning interfaces and the most convoluted and non-extendable architecture are invariably libraries and API's written by (and often for) mathematicians, physicists and electrical engineers. Common 'good software engineering practices' don't appear to apply to people from these fields, which isn't bad if they'd stick with solving the problem and prototyping a solution, then hand over their work to skilled software engineers that are qualified to turn it into good software. Using stuff like LAPACK, BLAS, CSparse, Matlab-type code etc is pure masochism for software engineers like myself.

    Ontopic for the submitter:

    Both sound useful to me, but many of the topics from the 'selected math chapters' are probably only interesting to get a basic understanding of what is what, and improve abstract thinking. If you're ever going to have to write software that does differential calculations or linear algebra all depends on the kind of problems you will work on. There's lots of stuff you don't need to know anything about applied mathematics like that for. Graph theory, data structures and algorithms on the other hand, are almost a fundamental part of any CS or software engineering education. While you can write quality software without any knowledge of linear algebra, I really doubt you'll be able to write quality software without knowledge of algorithms, complexity theory, graph algorithms and advanced data structures. They're the cornerstone of software that doesn't suck.

  • Re:Physicists? (Score:3, Informative)

    by dr_leviathan ( 653441 ) on Wednesday January 06, 2010 @01:00PM (#30671450)
    As a physicist turned software engineer I think you should take both math classes. Alternatively, take physics classes instead -- if you go far enough you will have to learn and apply almost all of those maths, plus others (linear algebra, series decomposition, approximation methods, and derivation skills, and general problem solving).
  • by hazem ( 472289 ) on Wednesday January 06, 2010 @01:05PM (#30671522) Journal

    I'd also recommend taking a look at Ars Digita University's old Computer Science materials at http://aduni.org/ [aduni.org].

    The discrete math course has nice videos of the lectures, so it could be a nice way to augment whatever course someone takes live. Plus there are additional problems (some with answers). And the book for the course, being 10 years old, can be picked up for under $10.

    http://www.aduni.org/courses/discrete/ [aduni.org]

  • by D Ninja ( 825055 ) on Wednesday January 06, 2010 @01:17PM (#30671684)

    Second this.

    User interfaces are terrible because of attitudes like the GP has because, at the surface, they *seem* simple so many people ignore them thinking that they'll just "slap on an interface" at the end. However, if you ever try doing some user interface design, it is a nightmare of a problem. To add to the list of courses needed, I would also throw in (non-math) courses on psychology - specifically cognitive, social, and visual psychology.

  • by Buzz_Litebeer ( 539463 ) on Wednesday January 06, 2010 @01:22PM (#30671760) Journal

    I took both discrete structures and vector calculus classes.

    I have used the discrete structures, graphs, algorithms far more than I ever use calculus. The only time I would have had a need to use 3d space mapped to a map (IE doing a map) there were plenty of examples for the specific task on the internet.

    That isnt, in of itself, an excuse but for the rarity of the need it was useful.

    I avoided video game programming because I realized that it is not a lot of "fun" it is mostly managing vectors and such, which is nice for those that want to do it, and I passed the classes required for it, but it simply was not for me.

  • by Anonymous Coward on Wednesday January 06, 2010 @01:45PM (#30672136)

    Well, if he takes calculus and vectors he'll also learn how to find his own solutions to an array of problems, just different ones. The thing is that the kinds of problems that you can solve with one of them are invariable either impossible or intractable with the other. The questions he should ask himself are things like "what do I want to do with my life - games or crypto?" and "what is easier for me to do on the side later in professional life if it turns out I needed it after all?" and "can I do them both?" and "do I really need either of them?" Most programmers don't touch maths any more these days. Most programming is either monkey work where someone else did the maths for you or design work where you build complex systems out of pre-existant parts that already contain all the algorithms you'll ever need and probably more efficient than you could ever hope to implement them yourself.
    P.S. Good courses dealing with vector calculus targeted at programmers will deal with tractability, precision, performance, data storage and other issues, and will learn you many a great lesson on doing for example matrix math efficiently, including the most important one: there are good matrix maths libraries out there, use them - people have devoted large chunks of time to small parts of them and you can't hope to outdo them. Avoid doing such low-level things yourself unless you genuinely have special needs.

  • Re:embrace the pain (Score:3, Informative)

    by v1 ( 525388 ) on Wednesday January 06, 2010 @02:04PM (#30672436) Homepage Journal

    if you don't have a good understanding of algebra and geometry, computer graphics coding is going to suck for you.

    I decided to write a primitive FPS, and the 3d rendering was an amazing retro back to the days of geometry... it would be totally impossible without a good background in geometry.

    Here's a simple one to wrap your mind around: lets say we're in a 2.5-D world. (there's a vertical element to view, but all walls extend from floor to ceiling, so it's basically 2D rendered in 3D) To draw the walls in the player's view you can take two approaches, depending on your language's graphics speed. (1) draw only the parts of the walls you have to, or (2) draw all the walls in view, from farthest to nearest, so the nearer walls draw over the farther ones. For the language I used, it was (2).

    So, what order to draw them in? Easy to determine really, but it relies on calculating intercept points. Given walls A and B, that have endpoints AX1,AY1 AX2,AY2 BX1,BY1 BX2,BY2, and the player's point PX,PY, you need to see if A blocks your view of B (one or both of its endpoints, or entirely) or vice versa or not at all. Then just draw the wall that is blocked first. Now start thinking about the math involved in doing that. iirc there were 28 distinct ways the two lines could be oriented relative to the observer, and I had an 18 page if-then-else ratsnest that ended up being a nightmare to debug but ran nice and fast.

    Required mostly being able to calculate x and y intercepts as well as whether intercepts were on the line, or on the line segment. The math of drawing the walls themselves was trivial by comparison with the math to figure out the order of drawing. I can't imagine the headache of a true 3D world with three-dimensional space and polygons.

  • Re:Physicists? (Score:5, Informative)

    by treeves ( 963993 ) on Wednesday January 06, 2010 @03:38PM (#30673694) Homepage Journal

    Pharmacists arent Chemists

    In the UK they are called that.

UNIX is hot. It's more than hot. It's steaming. It's quicksilver lightning with a laserbeam kicker. -- Michael Jay Tucker

Working...