views:

4053

answers:

21

In your experience as a practicioner, what's the most useful math knowledge for a programmer? If "it depends", what's your field of expertise and what do you need there most as far as math is concerned?

Can you point to any learning material for a beginner?

+2  A: 

The most helpful maths course I can remember taking is discrete maths back at university. Things like Boolean algebra. I can't say I've ever used calculus while programming, but I've definitely had to use De Morgan's laws etc.

Matt Hamilton
A: 

Statistics. (I'm ignoring simple arithmetic) I don't use statistics in any formal fashion on a day to day basis, but it's regularly used to make architecture and coding decisions.

Larsenal
A: 

I work in a research lab on a radiative transfer model. Most of our users are in the government or major defense contractors.

For day to day stuff, linear algebra is king. Many problems in other branches of mathematics (graph theory, calculus, probability theory) ultimately get linearized and represented as a matrix. A good understanding of eigenvectors, eigenvalues, matrix decompositions, etc is pretty essential.

Calculus and differential equations are critical when I interact with the labs physicists. It's their basic language.

Probability theory and statistics comes in mostly during validation, but lately we've been applying Monte Carlo techniques too.

Surprisingly, I don't use graph theory and "discrete math" that often.

There are tons of good textbooks out there for all these topics. Check out your local college for additional ideas.

nsanders
+3  A: 

I belive BODMAS is the most useful maths rules I've learned so far.

GateKiller
A: 

I kinda wanna just play the "college" card. I've used all of the math I've taken in programming at some point.

But since I know many successful programmers without college experience I'll take a stab at a real answer. The three branches that I've taken multiple classes in and have been helpful are:

  • Basic Calculus. Differentials, Integrals, etc. Nothing too advanced, just the beginings. This is just good knowledge to have and is useful when doing anytype of physics (aka modeling real world stuff).
  • Statistics. I learned most of what I know about stats from Wikipedia and it has been incredibly useful when playing with data.
  • Discrete Structures. This is the classic math for computer science. It goes over algorithms, efficiency, n-complete, graphs, trees, and lots of other stuff. I really hated it when I started it, but once you get into it, it's very interesting. I suggest browsing for a good book about this, the one we use at school is about 8 years old, and the basics haven't changed too much in the last ten years. Wikipedia isn't a bad starting place once again though.

Hope that helps. If you want to do graphics btw, you are gonna need to learn vector calculus, something I know very little about. And all of this implies you know high school math (algebra, trig, geometry).

icco
+2  A: 

If you want to break into graphics, I highly recommend linear algebra before delving into 3D graphics.

It deals with matrices and operations on matrices (and vectors too). You will learn things like translating points such that they rotate, scale, or even project them visually... it is the BASIS for any 3D graphics.

This was my book in college, and it seemed to be a pretty good book on the subject.

Mike Stone
+6  A: 

I would think that anything above trigonometry would begin to hone your brain for programming. Once you get into the Calculus you can begin to see where some of the notions of mathematics begin to creep into programming. Discrete math is without a doubt essential also.

The equation

f(x) = x^2

bears a a striking resemblance to

function square(x) {
    return x * x;
}

for a very good reason.

I have never really used my upper level math experience (minors in math and physics with a degree in computer science) in doing client consulting work, but they definitely share concepts and thought processes.

There are fields of programming that will demand certain math skills: 3-d graphics will require linear algebra, while bioinformatics would require good knowledge of statistics.

Of course don't forget, the study of algorithms in general is a field of mathematics.

Since I don't know your level of experience I can't recommend any good resources. I can recommend a few books that I have enjoyed and connected the two fields.

David Berlinski's A Tour of the Calculus was amazing. The book is about the Calculus, not how to learn it. His writing and examples are human and frequently profound. I will never dive off a diving board the same way again.

I also highly enjoyed Martin Davis's The Universal Computer. This book eternally bound math and computers in my mind forever. Computer are no accident, but a centuries old world wide mission.

Barrett Conrad
+1  A: 

If you are programming business web applications...Short answer is not much.

Not sure why I took 7 different mathematics courses and who knows how many engineering courses....

Jim
+17  A: 

Steve Yegge has an informative blog post about this (as usual, it's a exceptionally long, but good). Concrete Mathematics by Knuth et al. is maybe THE programming math book that comes to mind. Made to lay the foundation of math needed to understand The Art of Computer Programming, it was the basis of a course Knuth taught at Standford in 1970. Other than that various linear algebra books comes to mind, but none as important as this Knuth book.

mreggen
A: 

In the aspect of Computer Graphics, and Game programming, Linear Algebra is of course, THE area of math to know.

Yes, you can look up algorithms/equations for specific problems, such as point in polygon tests, there isn't much point in memorizing these things, but understanding the basics, Vector math, coordinate systems, and so on, helps designing and debugging all areas of game development to be much faster.

Adam
A: 

I did a maths class called Logic and Probability in my first year at uni and whilst I don't use the probability section too much anymore, I use the stuff I learnt in the logic part pretty much every day.

There are times when I'm debugging some complex logic where I break out a truth table or as Matt mentioned refactor something acording to De Morgan's Laws.

Apart from that, There's very little actual "Maths" that I use in my day job.

lomaxx
A: 

Discrete Math and Linear Algebra

These were the classes that I found really useful for programming... and everything is integer math! :)

The calculus classes were interesting, but not of so much use, at least in the fields I ended up working in.

Mark Harrison
+2  A: 

Although you might not use math directly in your programming job, I believe that taking college-level math classes are very valuable. Taking these classes is a really good method (although, not the only method) of developing your problem solving skills. It is sorta like learning "c". You might not use it in your job, but it will enrich your programming life. There are so many programming concepts that are closely related math.

Anyways, here is a list mathematical fields that I have found useful.

Set Theory: I found this especially useful when dealing with SQL. At the very least, you should understand Venn Diagrams. They are incredible useful.

Formal Logic: I found formal logic useful when dealing with complex "if else"/"case" statements. This field is even more useful when proving the correctness or simplifying these logical statements.

Linear Algebra: Linear Algebra is useful when dealing with graphics. You don't have a chance of really understanding the Graphic Pipeline without understanding matrices.

Vector Calculus and Multivariable Calculus: This field is incredibly useful when you are modeling any 3d object.

Differential Equations: Differential Equations are useful for modeling physical systems. This would be useful when creating physics engines or modeling any system (ie. stock market).

Eldila
Indeed. Computational physics ftw.
TraumaPony
+7  A: 

If one intends to do some functional programming, I would say it is quite an advantage to be comfortable with the mathematical way of defining functions, number sequences, and so on. Recursion is a good concept to understand, for example, as is induction.

Slightly off topic, but if one wants to combine math and programming, I would strongly recommend Project Euler, which really lets you get in to some heavy calculations, to get a feel for what is fast and what is not, when it comes to algorithms.

Erik Öjebo
+1 for project euler reference.
Ozgur Ozcitak
Yup, started doing project euler problems recently and learning a lot :)
Svish
+1  A: 

Most of my programming over the years have been business applications so I haven't used much maths other than basic algebra. To expand my BI skills I decided to learn more about Data Mining and came across an excellent course run by a Stanford professor that now works for Google. He taught an entire stats202 course at google (the same he runs at Stanford) and its available at google videos. I bought the book the course is based, and have been following the course. If you're interested in Statistics this is a great resource!

Good luck

Terry
+2  A: 

I would suggest Introduction to Algorithms. It not specifically about maths, but about algorithms in common use and the maths they involve.

This is a highly rated book, as you can see from the reviews on amazon

David Sykes
+2  A: 

Anything that will help you avoid the classic fencepost error. No matter how much advanced math a developer has in their background, I find everyone will fall for this one once in a while. Myself included!

Carl Russmann
A: 

Symbolic Logic was probably the best non-programming class I took in college. Of course, I was never that great at math, so I would pick something not mathy.

a_hardin
+2  A: 

Graph theory. It's in all software. http://en.wikipedia.org/wiki/Graph_theory

Its the mathematics behind networks.

Object interaction graphs.

Partitioning of networks
( reducing coupling in OO) ( splitting Client and Server tasks)

Language compliation often has intermediate DAG's (Directed Acyclic Graphs) Reachabilty graphs in user interfaces.

You might not use graph-theoretic proofs but you will be able to see the graphs.

Tim Williscroft
A: 

Similar question i asked before is here and i choose Yegge's blog entry as it had several other references. There were several other answers that were very helpful as well.

Jose B.
+1  A: 

For concurrency (e.g., parallel computing, multithreading, distributed computing) you should have a look at the pi-calculus and its variants.

For getting the most out of static type systems, look at type theory, set theory, algebras, and category theory.

Mark Cidade