Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

I'm almost brand new to programming, but have a fairly strong background in mathematics (primarily algebra and logic -- e.g. universal algebra). I've always heard that there is a strong relationship between math and programming, but the intro programming books I've looked at don't seem to emphasise it. For reference, I started with Java, since that's what I need to be able to use for a job I'm at this summer.

I imagine that most authors of these resources assume that if you don't don't have a programming background, then you won't have a math background. It makes sense to me though to use the background in math that I have to help the learning process. All that being said, are there any resources out there for a new programmer (hopefully related to Java) that also reference the mathematical concepts that are being introduced? Perhaps explaining things with analogies to math?

Apologies if this question isn't appropriate. I tried searching for such a resource, or an answer to this question on this site already, but have had no luck.

share|improve this question

closed as off topic by Robert Harvey, gnat, MichaelT, Bart van Ingen Schenau, Kilian Foth May 23 '13 at 11:19

Questions on Programmers Stack Exchange are expected to relate to software development within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here. If this question can be reworded to fit the rules in the help center, please edit the question.

"are there any resources out there..." -- resource requests (where every answer is equally valid) are not quite welcome at Programmers. Instead of asking for a resource, please ask a question about the underlying problem that your resource request is trying to solve. –  gnat May 22 '13 at 22:05
@gnat Sorry about that! This is my first question. On that note though, what would be a better way to phrase this for the question to fall within the site's guidelines? It seemed a little too ambitious to ask someone to explain the fundamentals of programming in java with regard to mathematical concepts. –  Stick May 22 '13 at 22:12
Will your programming job involve specific math knowlege (e.g., statistics)? If so, you may find more specific tutorials or books. If not, I would just recommend to ask for a general good book to learn Java. From my experience, a background in math will help when to have to solve algorithmic problems. If you have to do web development, on the other hand, I don't think it will help you very much to get started faster. –  Philipp Claßen May 22 '13 at 22:35
Apologies if this question isn't appropriate. -- It's your responsibility to figure that out before you post the question. –  Robert Harvey May 23 '13 at 0:37
You know everything you need to start programming already. Just freshen up your understanding of TRSes, and have a bit of practice with a couple of specific TRSes, like lambda calculus, combinatory logic and Turing machine. After all, programming is nothing but a bit of applied math. –  SK-logic May 23 '13 at 8:10

2 Answers 2

There is a strong relationship between maths and computer science. In case of programming itself, though, only basic maths and logic is required to be productive (enough for handling conditions of average complexity and counting loop iterations), and I believe this is what you're seeing in the books you were looking at. No wonder, since if those are introductory books, the authors are most likely concentrating on language syntax, some commonly used libraries and getting around to writing your first simple programs - not really something that would involve complex calculations. Truth be told, most people won't need much more in their day-to-day work.

There are certainly domains where you won't get far without a more thorough understanding of maths, and this is where you could get a mileage out of your math background. Computer graphics was mentioned, which uses matrices and trigonometry extensively. Algorithms theory is one of the cornerstones of any CS programme, and it will give you an appreciation of having a solid maths background if you jump into it.

You also have functional languages like Haskell and ML family (OCaml, F#) that are said to be particularly appealing to mathematicians due to more familiar syntax and solid roots in type theory and lambda calculus. Though I believe you would stray too far away from Java if you delve into them (and I'd expect you might be reluctant to go back).

To summarize, you will grow to appreciate your math background in time, but I wouldn't expect that you'll find it immediately useful or applicable if you're just starting out programming and your job does not explicitly involve doing some complex calculations.

share|improve this answer
Thank you! Good to know that it won't go to waste. It's just a matter of sticking with it then. –  Stick May 23 '13 at 2:42
Completely agree with the reference to functional programming. This is inherently algebraic - though it is far from the domain of Java. Perhaps functional programming is still waiting for a brilliant n00b to blow the lid of more "sexy" application –  Nick Burns May 23 '13 at 7:59
Do you really think that complexity theory, formal languages, graph theory, Hoare logic, information theory, combinatorics, term rewrite systems and such can be dismissed as "only basic maths and logic"? I'm not sure one can be really productive without understanding of the very basics of CS. –  SK-logic May 23 '13 at 8:15
@SK-logic: for a 90% of real-world programming tasks, you don't need those things you mentioned - CS has a very different focus than programming or software development, don't you agree? –  Doc Brown May 23 '13 at 11:32
@DocBrown, of course I do not agree. 90% of the real-world programming tasks could have been solved much more efficiently and with much better quality if all the things I've mentioned were systematically applied. The so called "enterprise software" is pathetic and generally is a pile of crap, simply because the vary basics of computer science are ignored, and a cargo cult "science" is applied instead, all that "best practices", "patterns", etc. –  SK-logic May 23 '13 at 11:51

Having a strong mathematical background has little to do with understanding computer programming. Computers are very efficient at performing math operations and as such they are often used to solve mathematical problems, but having a math background doesn't aid in being a good programer. That's more a myth started by school teachers to motivate students to learn math (ok, let the angry comments begin!). I'm sure there are a ton of programmers who had to suffer through long math courses who want to disagree.

The industry is sadly over populated with many programmers who have poor math skills. You don't need good math skills to make a popular farming game on a social network.

So if you are strong in math, than you have an advantage over the rest.

Not an advantage in computer programming, but in the ability to solve problems most programmers aren't able to tackle. There aren't going to be any beginner books for Java developers with a focus on math, because most Java developers aren't good at math. So you're better off to go where math people go. I recommend you attempt to master things like MATLAB and Mathematica. With these tools you'll be solving the hard problems, and then with some basic programming knowledge you'll be able to transfer that solution to things like Java.

share|improve this answer
Thanks, this was a great answer. I'm sadly stuck learning Java for this summer, but perhaps afterwards I'll try and shift my focus onto something else. –  Stick May 23 '13 at 2:42
Surprise! Mathematics is not all about "numbers" and such. And programming is just a tiny branch of mathematics, nothing more. –  SK-logic May 23 '13 at 8:12
Being myself a person with strong mathematical and strong programming background, I think your answer is only partially correct. You can do programming without any real mathematics and vice versa. But for both crafts, it is very helpful to have the abilities to create abstractions, work analytical and to solve problems. And if you have these abilities, it will help you beein a better programmer and a better mathematician as well. Nevertheless, +1, because there is much truth in your answer. –  Doc Brown May 23 '13 at 11:27
@DocBrown, just any kind of programming is mathematical. Programming languages are formal languages. Describing a problem solution in a formalised language is a math and nothing but math. And a problem can be solved better if you acknowledge this fact and apply more formal methods instead of doing that "monkey see - monkey do" cargo cult thingy. –  SK-logic May 23 '13 at 11:55
I kind of agree with SK-logic, if you think you aren't using maths while programming that's because you have rediscovered the maths involved and labelled it something else. That said it certainly also true that being a good mathematician isn't identical to being a good programmer –  jk. May 23 '13 at 12:00

Not the answer you're looking for? Browse other questions tagged or ask your own question.