92

I just started a diploma in software development. Right now we're starting out with basic Java and such (so right from the bottom you might say) - which is fine, I have no programming experience apart from knowing how to do "Hello World" in Java.

I keep hearing that mathematics is pertinent to coding, but how is it so? What general examples would show how mathematics and programming go together, or are reliant on one another?

I apologize of my question is vague, I'm barely starting to get a rough idea of the kind of world I'm stepping into as a code monkey student...

yannis
  • 39,547
  • 40
  • 183
  • 216
Rory
  • 237
  • 1
  • 4
  • 3
  • 53
    Programming *is* mathematics. http://en.wikipedia.org/wiki/Discrete_mathematics – SK-logic Feb 26 '12 at 17:51
  • 1
    @SK-logic your link does not answer his question. Voted it up. – TheTechGuy Feb 26 '12 at 18:08
  • 2
    @Dave, my link lists all the areas of mathematics which *are* the programming. There is nothing else but mathematics in programming. – SK-logic Feb 26 '12 at 18:10
  • @SK-logic, the link can be useful but it does not answer his question. Answering mean you have to convince someone weather it is true or not. He is just a "Hello World" programmer. – TheTechGuy Feb 26 '12 at 18:14
  • 27
    @Dave, that's why I gave a link in comment, not as an answer. – SK-logic Feb 26 '12 at 18:15
  • 3
    I'm having a problem at this time directly related to the assumption that mathematics is only a peripheral piece of knowledge needed for programming. Because of the failure of a programmer in understanding precision and accuracy, he failed to use precision in his equations and we have major problems with anything that computes taxation. Programming is a mix of knowing language structure, logic and math. If you can't ground yourself in the basics of all three, please don't program anything for me. – Fiasco Labs Feb 26 '12 at 18:22
  • 9
    @FiascoLabs, even more than that - language structure and logic are also sub-domains of mathematics. Programming is nothing but applied math. – SK-logic Feb 26 '12 at 18:24
  • @SK-logic, apologies, I thought you downvoted it :( – TheTechGuy Feb 26 '12 at 18:24
  • 19
    On an unrelated note, starting with Java is not "right from the bottom". – Matt H Feb 26 '12 at 18:55
  • 3
    @SK-logic, I don't think it is useful to say that programming *is* math. I've certainly known lots of programmers who work by memorizing a set of rules, and following a few recipes. If that is doing math, then all human activity is a form of math. If that's the case then the word math doesn't have a useful meaning, because it can't be used to distinguish one activity from another. – Charles E. Grant Feb 26 '12 at 19:20
  • 6
    @CharlesE.Grant, many math students do the same (and still pass their tests). – SK-logic Feb 26 '12 at 22:11
  • @SK-logic, certain but I don't think they're necessarily doing math. I think they're a concrete example of the "Chinese Room Paradox" http://en.wikipedia.org/wiki/Chinese_room – Charles E. Grant Feb 27 '12 at 01:17
  • To succeed in both, you need attention to detail, some cleverness, some speed. I think they dance well together. Math was the precursor of CSCI – Caffeinated Feb 27 '12 at 04:15
  • @SK-logic That's a completely unhelpful one line answer masquerading a comment. Why not explain yourself and post it as a real answer? – Kirk Broadhurst Feb 27 '12 at 05:15
  • 2
    @KirkBroadhurst, others gave reasonably good answers already (although not featuring this essential link). I'm not comfortable enough trying to give comprehensive and easy to understand answers to the complete beginners, all my previous teaching experience covered only already somewhat seasoned students (either in math or cs or physics). – SK-logic Feb 27 '12 at 06:48
  • Shame there are so many answers about specific branches of maths (e.g. calculus/trig/etc) instead of the concepts of notation, set theory, etc. – John Ferguson Feb 28 '12 at 23:29
  • 1
    I believe that, those who program without having studied discrete math, are [condemned to reinvent it](http://gcbenison.wordpress.com/2012/03/28/the-nerdy-stuff-matters/) - poorly – gcbenison Mar 30 '12 at 15:41
  • The relationship between mathematics and software is very important from a patent point of view as Mathematics is not patenable. http://www.groklaw.net/article.php?story=20110908075658894 – Jaydee Apr 04 '12 at 10:52
  • Related: [Do you have to be good at math to be a good programmer?](http://programmers.stackexchange.com/questions/89158/do-you-have-to-be-good-at-math-to-be-a-good-programmer) – legends2k Jun 02 '14 at 18:16
  • Donald Knuth. Mathematicians think that he is a programmer, programmers think that he is a matematician. He, therefore, must connect these two fields. – Val Jul 12 '14 at 06:11
  • Programming is the act of providing coded instructions. That's all it is, and it's simple to grasp and understand. If you've used a remote control, you've already programmed. Mathematics is a little trickier, it's root means learn, and it later was defined as the art of learning. They intersect at three levels, first, we learned how to make computers from math, thus learning about them involves math, second, we use math to learn how to program more effectively, and finally, we often program the computer to have it do math for us. Computer Science brings the two together into one discipline. – Didier A. Jun 09 '16 at 01:25

26 Answers26

141

First off: I am a mathematician - a professional one (in that I get paid for doing maths). I am not a programmer. I do do some programming, but very definitely of the Cargo Cult variety (see first comment to https://tex.stackexchange.com/q/451/86 and my response) and nothing of the sort that would normally bring me to this site (indeed, I registered here to post this answer after seeing a link to it in the TeX chat room).

The summary of my answer is: Mathematics is Programming.

I recently got to teach a mathematics course to a non-mathematical group of students. They were the programming section. I thought this was fantastic! At last, I was going to be able to teach mathematics to people who already understood the basic ideas and who already had a rudimentary toolkit for doing maths. I was incredibly disappointed when I asked how many of them had actually written a program and got an answer somewhere between 0 and 1.

Before I go on, I should clarify a few things. There are areas of mathematics that concern themselves directly with programming and are to do with evaluating algorithms and classifying languages and such-like. I'm not talking about those. There is also a program which is trying to translate all of mathematics into a formal language that can be evaluated by a computer. This is a bit closer to what I'm talking about, but even so to focus on that would miss the main part of what I'm trying to say. The mathematics that I do and the programming that I do are almost completely unrelated by topic. The connection between them is on a different level.

Where I'd like to start is with the comment on the main question:

If that is doing math, then all human activity is a form of math. If that's the case then the word math doesn't have a useful meaning, because it can't be used to distinguish one activity from another.

Yes, that is doing maths. But "maths" is still a useful word because, as the song says, "It ain't what you do, it's the way that you do it.". I would say that I am doing maths when I am approaching something in a mathematical way. Sometimes, that is "hard core" mathematics: formulating definitions, proving theorems. Sometimes, it isn't. Sometimes, it's writing silly little programs so that my kids can learn their spelling words.

This is what mathematics helps me with when I program:

  1. Abstraction This is probably the most important transferable skill from mathematics. By this, I mean the ability to strip away all the unnecessary stuff and focus on the important properties.

  2. Perspective If I could only choose one thing that all my students were to learn, this would be it: The ability to change ones point of view to suit the problem. We commonly treat this in linear algebra with change-of-basis formulae (that lead to horrendous matrices and horrendous complications), but it is much more applicable than that. At heart, it is the idea that just because something has been presented to you in one fashion, that doesn't have to be the way you work with it. This separates ones view of the thing itself from the way it has been presented. This can be extremely practical: it is all about making something useful or efficient. If I have a list of vectors and it is more efficient to store them as a list of x-coordinates and a list of y-coordinates, so be it.

  3. Form versus Function Leading on from the above; if a thing can be presented in many different ways then it is no longer fair to say that one particular presentation is the thing. To misquote that song again: "It ain't what you are it's what you do" that matters.

I could go on, but those are the ones that spring to mind.

Now, there are probably lots of (negative) reactions to what I've written so far. One will be "That's not maths, that's just good sense." (or bad sense) to which I refer to my remark above agreeing with the sentiment that "all human activity is a form of math". Another will be "That isn't the type of maths meant in the question.". This is almost certainly true and here I actually have a lot more sympathy with the person who said "At least I haven't touched the maths for 10 years,". He or she is wrong, of course, they have been doing maths for 10 years because whenever they wrote a program they were doing maths. They just didn't realise it. And here we get to the point about why I was delighted with the (sadly unrealised) possibility of teaching mathematics to students who were already programmers.

I do actually use some "real maths" in my programs. I recently coded a fun 3D shape explorer which involved using some maths to figure out the projections and other transformations that I had to apply to my data. I was mildly amused to find myself actually coding quaternions! But of course, the maths that was involved was trivial compared to the maths that I do when I'm working. It was "back of envelope" stuff. That type of maths, then I agree with the sentiment that you pick it up when you need it, and if you need something more complicated than you can find on Wikipedia then you find a real mathematician to do it for you. However, in order that you can pick it up when you need it then you need to have learnt something. That thing might not be anything you ever actually use, but having learnt that something makes it all the easier to pick up what you do actually use later in life. So this is where I disagree with Coder: you do need to learn some mathematics if you are ever going to use any mathematics and you need to learn it from the mathematical side (which doesn't mean proving theorems, by the way).

And so finally to the "Mathematics is Programming". You can learn all of these things from being a good programmer. And if you've learnt these things, you will find mathematics much easier because you will understand that when we talk about a vector in a vector space then it's just an instance of the class Vector which means that we can do all the things that Vector does to that instance: add, subtract, scale, and so forth. That's why I would love to teach mathematics to programmers. But, speaking as a mathematician, I would say that the first of these, "Abstraction", is easier to learn in mathematics than in programming because mathematics is the pursuit of abstraction. Whenever we see some behaviour our training is always to ask "What is it about that thing that makes it behave in that way? What if I took another thing that was similar, would it behave in the same way? How much of what that thing is would I have to lose for it to stop behaving like that?" (Taking this to the extreme leads to "centipede mathematics" - search for the term). But we don't do this with (just) "real world" objects (whatever they are), we do this with things that have already been abstracted.

This has gone on long enough, so let me close with one of the classic mathematician jokes:

A mathematician and a physicist both attended a seminar on some new model involving 24 dimensional space. Afterwards, they were discussing it and the physicist remarked: "That was really hard. I mean, how does one visualise 24-dimensional space?" to which the mathematician replied: "Oh, it's easy. Just visualise n-dimensional space and then set n = 24.".


Added 2012-03-2

There were quite a few comments on this answer expressing a variety of views. These have now been deleted by a moderator on the understanding that I would try to take into incorporate them (or respond to them) in my answer.

However, I'm not sure that I can. Reading those comments and the rest of what's on this page, I can only come to the conclusion that there is a huge misunderstanding as to what mathematics actually is. Moreover, I don't feel competent enough to explain it. Fortunately, someone has already linked to Lockhart's Lament so I'll defer the explanation to that. Whilst I might have put it differently (as I grew up in a scientific environment, I would have put more emphasis on the experimental nature of mathematics), I don't think I could put it better.

I do still think I can add something. As well as the misunderstandings as to what mathematics is, there are also misunderstandings as to what "doing mathematics" means. I see two almost contradictory stances:

  1. Mathematics is about equations and formulas. So there's no need to study it because Wikipedia exists (this is almost the converse of Euler's apocryphal challenge to Diderot).

  2. Mathematics is about theorems and definitions. So there's no need to study it as programs never prove anything (which is about as complete a fallacy as ... insert favourite fallacy here).

Whilst the two stances contradict each other, they end up in the same place: there's no point in a programmer learning any mathematics - and most assuredly not from a mathematician! After all, what do they know about anything? Anything that a programmer really needs to know can be found in Wikipedia, or cribbed off someone else.

Above, I described myself as a Cargo Cult Programmer. I bet most of you had a private giggle to yourself and thought, "Ah yes, I bet I know what your programs look like then.". You probably felt a bit smug and superior (though I'm sure you felt bad about feeling smug and superior).

What I've described just above is Cargo Cult Mathematics.

So when I say that you should learn a bit of mathematics to understand how mathematics works, I'm saying it for exactly the same reason as you might if you saw a bit of code that I'd written: "How much easier your life would be if you'd stop cut-and-pasting code from StackOverflow and learnt just a bit about how to do it properly.".

The most important thing, though, is that you should learn it from mathematicians. Why so? Here's an analogy. The language that I'm most adept at is TeX. (Says it all, really!). Now, suppose I want to learn a bit more about TeX and it just so happens that Don Knuth is in town and has offered to give some tutorials on TeX. Or I could just read about it on Wikipedia. Or maybe it's Perl and Larry Wall, or C# (is that the right one?) and Jon Skeet. It may well be that these people are not the best teachers, but they sure make up for it in the amount that they know!

And that's what mathematicians are. We're the people who write the actual language, who then write the libraries that you use. Of course, you don't have to know how to prove a theorem - you're not going to write a library! But if you know a bit about how we think, then it might help you understand why we wrote the library the way we did, and if you understand that it might help you make better use of it.

There is a middle ground between looking up equations on Wikipedia and proving the Poincaré conjecture, just as - to refer to Lockhart's lament - there is a middle ground between "I don't really know much about art, but I know what I like" and being Monet, and between "Where's the 'ANY' key?" and being Don Knuth. If you are still in university then you have an amazing opportunity to learn from people who are experts in their area and who - for some reason - are willing to spend their time explaining it to you.


The other point I wanted to expand on a bit was why as a programmer you should not be scared of learning a bit more mathematics. It's not the Deep Connections, nor the usefulness. It's that your ability to program a computer can directly help you learn mathematics. I just want to mention a few.

  1. Understanding variables. So many people get confused by simple statements like "Let n be a natural number ...". Or "Let epsilon > 0". There are places in mathematics where it's important to remember the scope of a variable. These are all commonplace in programming. Learn to translate a mathematical statement into a program and you'll find it much easier to keep track of what's what.

  2. The nature of proof. If you've ever written a test, or written a program to be used by someone else, then you understand the core of proofs. When you do that, you have to know that whatever the user puts in, you can deal with it (insert obligatory xkcd reference here). That's all a proof is! A demonstration that whatever the "user/universe" puts in, the statement will hold. Experimentalists will lean to the "If it works under normal circumstances, it's true" but programmers know that there is always that kid who will try Alt+G+Shift+ÅØÆ just to see what happens.

  3. DRY. Sorry to break this to you, but we invented it, not you. We've been "not repeating ourselves" for millennia. That's why I have a copy of Euclid's elements on my shelves and it's still useful.

And there's more. If I knew a bit more about programming, I'd write a book called "Mathematics for Programmers" where the aim wasn't to teach "The mathematics that programmers should know" but "mathematics that everyone should know, but optimised for programmers". But I'll probably never know enough about programming to write it - unless someone offers to collaborate with me!


I'll leave it there. Probably if I thought more, I'd change what I've written; hopefully I'd explain it better. In a months' time I might even disagree with parts of it. If anyone wishes to argue further, or comment otherwise, probably best not to do so in the comments here. You know where to find me.

Andrew Stacey
  • 341
  • 1
  • 2
  • 8
  • 19
    This is one of the best answers I have ever read on SE; BTW, there *is* a grand book of "Mathematics for Programmers"; it's called [*Concrete Mathematics*](http://books.google.com/books?id=pntQAAAAMAAJ) and it's co-written by the author of TeX, Donald Knuth. I just got a copy, and it's fantastic. I feel like your inverse; I got serious about programming when I realized that the best way (for me) to understand concepts in math class was to write a program to do it for me. Of course, then I wanted to *use* the program instead of doing rote computation by hand, and my math teachers did not like. – Jason Lewis Mar 02 '12 at 23:36
  • 1
    Dude, +100 for that. – Barry Brown Apr 03 '12 at 22:03
  • 3
    Registered just to upvote this – leo Apr 18 '12 at 01:05
  • Exactly. You cannot program well without the analytical thought that mathematics teaches you. – Fiasco Labs Apr 22 '12 at 01:56
  • Well, I like to see that things are identical essentially, at the abstract level. Yet, I am punished for that thinking. Mathematicians say that programming functions are not pure and just punish me when I ask to clarify the difference between single num and single-entry vector, http://math.stackexchange.com/questions/384927. They say that there is not single notion of vector, e.g. programmers forbid to think about objects as collectins of fields which identifies them with DB records and dynamical system state vectors. – Val Jul 12 '14 at 06:59
  • That is why they are so sure (you mock this belief out in your answer) that DRY does not exist outside the field, though it is universal principle of any truth/beauty/efficiency, aka Occam's Razor. I am tired of programmer stupidity and math arrogance. – Val Jul 12 '14 at 07:01
  • 1
    Is there a good book on the math OF programming (looking at programming mathematically)? – qed Oct 22 '14 at 14:55
  • An important point I should point out is I'm not sure how often this is really taught in a math course. E.g. I see many problems like "Solve equation X" or "Crunch out integral of Y" or whatever, but not many problems of the form "Find 3 different ways to define/describe a Z", which is REALLY what you want to get that vital abstraction capability. If you don't exercise that specifically, you won't have it. – The_Sympathizer Mar 06 '16 at 04:02
  • @mike3 It depends. In beginning Analysis you would prove the equivalence of sequential compactness and topological compactness. Depending on the proof, the wrong choice could be difficult or impossible to use while the other is trivial. There is a mapping between constructive proofs and programs, https://en.wikipedia.org/wiki/Curry%E2%80%93Howard_correspondence. Even the above examples you mentioned are often solved by Wolfram Alpha. How that is possible is important to both Math and Computer Science. – Polymer Mar 11 '16 at 16:43
  • Great answer! Thanks. I'm a programmer that found the Maths papers requisites for Comp Sci hard in university as they never related it to anything, even abstract, just a bunch or rules and corollarys. I passed but was none the wiser what to do with what I learnt. I have come back to it 10 years later and looked for better explanations and for some reason it seems to make more sense and is very very interesting. I wish I had this insight years earlier. – theringostarrs Apr 08 '18 at 15:18
26

They're not that closely related. For programming, it is important to know about mathematics- especially those branches pertaining to, for example, algorithm performance, but the simple fact is that there is no branch of mathematics that will tell you that Singletons are a horrifically bad idea, for example, or when to favour inheritance over composition, or whether or not you're really going to need that flexibility, and not to repeat yourself, and dozens of other core programming necessities.

Mathematics might be able to express what your program does, but it most certainly cannot tell you the most maintainable, human-readable, feasible way to go about it.

DeadMG
  • 36,794
  • 8
  • 70
  • 139
  • 7
    1) There is nothing wrong with singletons per se, 2) algorithmic information theory, formal languages and denotational semantics are directly relevant to those simple things you're so concerned about for some reason (they're not that much of an importance for programming in general). – SK-logic Feb 26 '12 at 18:01
  • 1
    @SK-logic: Yes, Singletons are absolutely terrible, and in my experience, formal language theory had virtually nothing useful to say about building an actual language. – DeadMG Feb 26 '12 at 18:16
  • 20
    your experience must be somewhat limited then. Singletons are necessary and unavoidable, as long as they're part of a domain model. And how to build a domain model is a mathematical problem, nothing more. And yes, those who are ignorant in formal languages theory are producing horrible models and awful languages. – SK-logic Feb 26 '12 at 18:20
  • Your edit does not save your answer. Mathematics *do* explain which solution is the simplest, most readable and most adequate to the problem domain. Information theory is all about this sort of things. – SK-logic Feb 26 '12 at 18:21
  • 3
    @SK-logic I'm just a bit curious as to your practical programming experience given your rather firm assertions. Just where are you drawing your information from? –  Feb 26 '12 at 18:52
  • 1
    @SK-logic: I'm not interested in saving my answer from you. You and I have very different opinions about what makes a good or even a high-level programming language, and there's little question that I am never, ever going to change my answer to one that you agree with. – DeadMG Feb 26 '12 at 18:54
  • 2
    If two people have diametrically opposed and absolute views about something then, to me, the truth probably sits somewhere in the middle of the two extremes. – dave Feb 26 '12 at 19:30
  • 1
    @GlennNelson, I've been programming professionally for more than 20 years. Why are you asking? Well, my area of expertise is a bit narrow (as for everyone else, I bet) - compilers, interpreters, code analysis tools, database engines, embedded hardware. But there's nothing controversial about my statements, every computer scientist would agree. – SK-logic Feb 26 '12 at 22:06
  • 2
    Singletons are useful, as are global variables; but both should be used sparingly. See http://gamedev.stackexchange.com/questions/14217/several-classes-need-to-access-the-same-data-where-should-the-data-be-declared/14232#14232 – BlueRaja - Danny Pflughoeft Feb 26 '12 at 23:32
  • 10
    @dave: the danger in that method is that anyone can skew you away from a sensible, well-reasoned position by stating a wildly differing one, no matter how stupid. Taking averages is no useful substitute for evaluating arguments. – Michael Borgwardt Feb 26 '12 at 23:44
  • 4
    @SK-logic: Is it possible that you two are simply talking about different notions of what exactly is a "Singleton"? It seems to me that SK-logic is talking about the abstract idea of having only one instance of a certain entity in a system, which is sometimes exactly what is required. Unfortunately this abstract concept got closely coupled to the horrifically bad implementation detail of having a public static factory method because the GoF book gave that as an example of how such a Singleton might be accessed. – Michael Borgwardt Feb 26 '12 at 23:48
  • 6
    Please not more **Off Topic** discussion re Singtons – mattnz Feb 27 '12 at 00:18
  • 2
    Comments are not suitable for extended discussions, if any of you feel like continuing this one, please use chat instead. – yannis Feb 27 '12 at 01:13
20

Math and programming are related in two ways.

One is that math can be used to reason about computer programs. It can help answer questions like "How will the running time of my program change as the input data changes?", "Is my program guaranteed to find an answer to my problem?", "Is my program as efficient as it could be?", "How should I re-arrange my program to make it faster or use less memory?". You typically cover topics like these in upper division courses on the theory of computation, the design of algorithms, and computer language design.

The second way math and program are related is that programming is used to solve mathematical problems. This is important because many problems of "ordinary life" can actually be recast as mathematical problems and then solved (maybe approximately) on a computer. These sorts of topics will show up to some extent in almost all of your courses, but particularly in courses on discrete math and mathematical modeling.

Charles E. Grant
  • 16,612
  • 1
  • 46
  • 73
  • Math cannot help you guarantee that your program will find an answer. That would be solving the Halting Problem, which is impossible. – DeadMG Feb 27 '12 at 07:40
  • 6
    @DeadMG It's impossible for arbitrary programs. A given program can very well be proven to terminate or not terminate, in some instances. – Luc Danton Feb 27 '12 at 07:57
  • 6
    @DeadMG, That's a common misunderstanding of the Halting problem. The Halting problem doesn't say you can't prove whether a particular program halts or not, it says there is no single algorithm or proof that can be applied to all programs to decide whether or not they halt. See for example http://en.wikipedia.org/wiki/Halting_problem and http://programmers.stackexchange.com/questions/125882/is-there-a-subset-of-programs-that-avoid-the-halting-problem. – Charles E. Grant Feb 27 '12 at 07:59
  • Aaaah. My mistake, then. Stupid vote lock-in... if you could edit your post so I can un-downvote it? – DeadMG Feb 27 '12 at 08:03
  • @DeadMG, Done. Feel free to unvote if you like. No biggie. – Charles E. Grant Feb 27 '12 at 08:05
  • 4
    @DeadMG, are you aware of the fact the most of the typical programming tasks do not need a Turing-complete language *at all*? And for the rest of the cases, there is almost always a specialised halting proof. – SK-logic Feb 27 '12 at 08:08
12

Two specific examples where a math education is important to computer science are:

1) Relational databases where relational calculus is used.

Relational calculus consists of two calculi, the tuple relational calculus and the domain relational calculus, that are part of the relational model for databases and provide a declarative way to specify database queries. This in contrast to the relational algebra which is also part of the relational model but provides a more procedural way for specifying queries.

The relational algebra might suggest these steps to retrieve the phone numbers and names of book stores that supply Some Sample Book:

Join book stores and titles over the BookstoreID.
Restrict the result of that join to tuples for the book Some Sample Book.
Project the result of that restriction over StoreName and StorePhone.

The relational calculus would formulate a descriptive, declarative way:

Get StoreName and StorePhone for supplies such that there exists a title BK with the same BookstoreID value and with a BookTitle value of

Some Sample Book.

The relational algebra and the relational calculus are essentially logically equivalent: for any algebraic expression, there is an equivalent expression in the calculus, and vice versa. This result is known as Codd's theorem.

The next area is artificial intelligence (AI) and machine learning.

For an example on how these are used take a look at udacity's class CS 373: PROGRAMMING A ROBOTIC CAR.

Description: This class, taught by one of the foremost experts in AI, will teach you basic methods in Artificial Intelligence, including: probabilistic inference, computer vision, machine learning, and planning, all with a focus on robotics. Extensive programming examples and assignments will apply these methods in the context of building self-driving cars. You will get a chance to visit, via video, the leading research labs in the field, and meet the scientists and engineers who are building self-driving cars at Stanford and Google.

Prerequisites: The instructor will assume solid knowledge of programming, all programming will be in Python. Knowledge of probability and linear algebra will be helpful.

WEEK 1:

Basics of probability Car localization with particle filters

WEEK 2:

Gaussians and continuous probability Tracking other cars with Kalman filters

WEEK 3:

Image Processing and Machine Learning Finding objects in sensor data

WEEK 4:

Planning and search Determining where to drive with A* search Finding optimal routes with dynamic programming

WEEK 5:

Controls Controlling steering and speeds with PID

WEEK 6:

Putting it all together Programming a self-driving car

WEEK 7:

Final Exam Exam testing your knowledge

JonnyBoats
  • 1,783
  • 13
  • 11
  • I guess this falls under the realm of AI but most people have this pie in the sky picture in their mind when that term is used. Anyways, nearly any program that simulates the real world almost always requires some form of more advanced mathematics. Also, any system with sensors almost always requires some form of advanced mathematics. – Dunk Feb 27 '12 at 16:18
11

For scientific application development, Game programming, real-time systems, simulation systems, and such applications, Mathematics is required indeed. After all, programming uses mathematics and science to solve problems. On the other hand, to program an application that captures users information for registering them in your database, does not require any high level of mathematics. Nevertheless, all programmers would benefit from Basic Number Theory, Algebra, Basic Set Theory and Elementary Numerical Analysis.

From the mathematics practitioner side, different topics in Mathematics (as well as many other science branches) could benefit significantly from programming.

NoChance
  • 12,412
  • 1
  • 22
  • 39
  • I agree. I do a lot of enterprise development and haven't found myself needing to use a lot of advanced math, although it is definitely good to know as it can definitely help. I'd say every programmer should have taken at least Calculus 1. Other types of programs may utilize things like Fourier Transforms, statistical models, and 3D programming uses matrices often. – Makotosan Feb 27 '12 at 15:47
  • @Makotosan, thank you for your comment. Math is very interesting however, given the short time a programmer has, effort is best spent on what really increases one's productivity. Extra information becomes luxury for those who can afford it. – NoChance Feb 27 '12 at 16:30
  • I think that the math is just the domain knowlage needed for your program, in the same way that understanding finance is important for Excel developers. – sixtyfootersdude Jun 29 '15 at 20:17
9

I think more than anything else, it's the similarity of the thought process used that makes the two seem so similar.

For example, both are extremely logical. If you follow the same set of steps or same formula, you'll always come up with the same result. For example, 1+1 will always be equal to 2, and set a = 1 means a will always be 1 (until you set it to something else)

Another example is the need to think spatially. In mathematics, I found I often had to hold numbers in my head and visualize what I was doing. As a very simple example, I would break down math problems so that something like 13x13 becomes 13x10 + 13x3, which is much easier for my brain to work with, and I need to keep track that 13x10=130 + 13x3=39, so 130+39 = 169. This same ability to visualize something not visible, or break down a problem into smaller problems is often applied to programming.

So I feel that although you do not need to have a mathematical background to program, where math is defined as performing calculations with numbers, you do need to have similar thought process and understanding as what you would use when solving math problems.

Rachel
  • 23,979
  • 16
  • 91
  • 159
  • And some basic mathematics is the usual stepping stone to gain that systematic, logical problem solving process. Language structure, something that's not taught in school anymore is also another stepping stone. There's a reason that a compiler has a parser and the better you are at parsing and paying attention to the structure of your code, the more likely you'll be able to program well. – Fiasco Labs Apr 22 '12 at 02:00
5

I suppose, to date, you've been taught elements of calculus and some trigonometry. And you call that Mathematics. That's like calling a pair of legs "a human being."

Calculus have little to do with programming, and is more tightly related to physics and engineering. You will need physics for game engines and calculus for statistical analysis. (Statistical analysis drives more jobs that it is comfortable to admit)

Calculus, for us, is more about relating programming to the real world. Computational calculus is the branch that studies how bad that relation is going so far. (spoiler: it's going pretty bad, but we can keep it in check indefinitely)

Trigonometry is a crazy jack in the box that comes out when you least expect it and then signal analysis, audio generation and many other stuff depend on it.

Go trough Algebra 101 and Logic 101, study the history of Pascal, Leibniz, (yeah he almost invented calculus, got it halfway wrong, argued with Newton until it all started making almost sense - and still conceived the binary coding thing) and Babbage and many of your doubts will wane. (your definition of Mathematics will be forever changed, though)

ZJR
  • 6,301
  • 28
  • 36
4

Programming crosses a lot of traditional academic disciplines.

Mathematics, especially applied mathematics, is important to programming because a lot of what we ask computers to do is crunch numbers. Understanding numerical methods and how to apply computation efficiently and appropriately is one of the things many programmers do on a daily basis.

Joel Brown
  • 2,388
  • 1
  • 19
  • 17
4

Here I will tell you practical stuff where I have encountered Mathematics in solving some Computing Problems (particularly in Internet domain) :

  1. Search Engines uses Vector Calculus for searching data.
  2. Matrix Factorization can be used for a lot of stuff like Sentiment Analysis.
  3. You need to know Calculus, Summations for figuring out complexity of code that you write.
  4. Probability is heavily used in Probabilistic Information Retrieval/Search
  5. Naive Bayes Theorem is used in Predictive Analytics.
  6. You need to know stuff like hyper plane etc for a concept called SVM which is again used in Machine Learning for solving categorization problems.
  7. You need to understand Entropy for doing Natural Language Processing stuff.
  8. Latent Semantic Indexing/ Principal Component Analysis used by Search Engines relies heavily on matrix algebra. & so on......
Yavar
  • 212
  • 3
  • 10
3

A problem with your question is that "mathematics" and "programming" are both very wide and deep subjects about which there is more to know than anyone could master in a lifetime (no exaggeration). I personally hold an MA degree in mathematics. During my time in university, it seemed as if the more I learned, the less I knew compared to my peers; it felt is if I became less intelligent over the years. When I presented my master's thesis to a group of professors, even most of them seemed to be largely unfamiliar with what I studied.

Likewise, I am now a database-driven web application developer. If you compared me to someone who does embedded assembler language programming, you might think of us as two very talented professionals, but we would have vastly different expertise even though we're both "programmers".

As you progress in your study of higher mathematics (beyond freshman calculus), you will find that mathematics instills a discipline for abstract reasoning that will serve you well when you program. I think that this discipline is very important because you will deal with abstract concerns as you program.

Sure, in freshman programming, you will likely learn about pointer arithmetic. You will write short programs to illustrate this concept and your understanding of how it drives your computer obey your will. However, learning about how pointer arithmetic works in the abstract will not make you good at using pointers in a real program. When it comes time to take on a mess of 10K lines of code and make some changes to the pointer arithmetic, you will need to be able to reason at a very abstract level, making strategic decisions to balance different concerns about how your changes will affect the code.

As a programmer, you must balance "readability" of your code, performance of your code, ease-of-use of the resulting programs, among many other concerns. You must be able to make very abstract comparisons to balance these concerns among one another. You will make many of these comparisons every day. I haven't even gotten started about time-management. You will abstractly reason about the probability that something you do will affect your ability to do your tasks on time, and once again, you will make many decisions every day that will affect your work.

Finally, you must maintain your philosophical discipline to be able to assimilate new ideas and concepts in order to be able to continue on as old methodologies and practices fall out of use. Once again, you will have to be able to evaluate the ideas that come along and make an abstract comparison to what you already know.

In short, programming, as most of us know it, doesn't have a whole lot to do with mathematics, as most of us know it; but when you look at it at an abstract level, they have a lot in common.

Vivian River
  • 2,397
  • 5
  • 21
  • 32
  • I particularly like the "as most of us know it" part. That's the difficulty that I see in reading most of the answers here: the "left hand" doesn't know what the "right hand" is doing. – Andrew Stacey Feb 29 '12 at 09:31
  • I guess "the left hand doesn't know what right hand is doing" sums it up. The OP said that he is "starting from the bottom" with Java. Programming in Java is sort of like building something from bolts and lumber from the hardware store, as opposed to machining those bolts and making live trees in to lumber (which would be more like programming in Assembler) – Vivian River Feb 29 '12 at 15:21
2

Math describes (say) a cubic equation.

An algorithm describes how to solve that cubic equation.

Constructing that (or any) algorithm in a way that can be executed by a machine is programming.

Computer science is the analysis of the algorithm - its theoretical time/space efficiency, error bounds, etc. This much could be considered a branch of mathematics. Note however that computer science and programming are not actually the same thing. It is important to have a foundation in computer science if you want to be a good programmer, because it helps you to better design and reason about the algorithms you develop. But it is not a requirement.

A good programmer may not be (in fact, often is not) a good mathematician, and vice versa. They are separate identifiable skills.

mcmcc
  • 233
  • 2
  • 8
  • 3
    It depends on your domain. If you just want to be a programmer then you don't really need to know math. If you want to become a key part of the business (in many domains) then being able to come up with solutions to domain problems is essential. Very frequently those solutions can only be derived by having a solid mathematical background. You may not need to be an expert at any specific mathematical area but you should know how to apply a wide array of mathematics so you can figure out what math might solve your particular problem of the moment. – Dunk Feb 27 '12 at 20:47
2

I've seen a lot of questions on thes types of forums through the years where the real problem lay in the poster's poor mathematical understanding. For instance, anyone who has a good foundation in algebra understands that you can't divide by zero. But I've seen many a question where the poster didn't understnd that and subsequently didn't understand the error message that said basically "you can't divide by zero." I've seen a lot of questions where it was clear the poster didn't understand basic logic. I've seen way too many questions where the concepts of boolean algebra where clearly not understood.

Just because you aren't writing mathmatical proofs or directly solving equations like in the math textbook doesn't mean you don't need to understand the concepts behind them. Incidentally, in many years of work experience, I have never run into a bad programmer who had a solid understanding of math.

In some fields you use a lot of mathematics directly, such as game programming, statistical programming, financial programming, some embedded systems. In some of these instances you are given the equations you need in the requirements and sometimes you are not. However even when you are given the equation, translating those equations properly into programming code requires that you understand the equation to begin with.

While you can get by with little more than basic algebra in your basic CRUD application, most of the more interesting problems and more advanced work involves mathematical understanding. So why would you want to limit yourself from the start by not learning mathematics in depth?

HLGEM
  • 28,709
  • 4
  • 67
  • 116
2

Two examples that immediately come to mind are:

functions - The idea of applying a transformation to input variables to produce an output variable is strongly rooted in mathematics. The notion of passing a function around as a parameter to another function even more so. In general, the notion of abstract thinking associated with programing parallels mathematics quite closely.

bitMasks - This common programming approach to solving problems requires at least a basic understanding of boolean algebra to even grasp the concept.

JohnFx
  • 19,052
  • 8
  • 65
  • 112
1

From a programmers perspective: Mathematics is a subset of programming.

Maths applied in programming:

When working with collections (arrays, lists, maps, etc) in programming, then you are dealing with real world implementations of mathematical abstractions.

Programming without maths:

If you do println("Hello World"), then the fact that some math is used to calculate the position on the screen, the length of the string, etc, is really mostly irrelevant.

Using programming for maths:

Implementing mathematics and physics in a programming language makes things like computer aided design possible.

Jack
  • 507
  • 4
  • 11
  • There is an intersection of things which are both math-related and programming related. Neither is a proper subset of the other. If you knew more MATH, you'd know that. Let's draw a venn diagram, and see if we can find an item in each area. Algebra is math related and programming related. Principles of Object Oriented Programming are not strictly math-related, but are abstractions, as math is an abstraction. Discrete mathematics is incredibly useful to programmers, as is statistics. Calculus seldoms come up for most programmers, never yet for me in 30 years. – Warren P Feb 29 '12 at 14:51
0

Programming is usually based upon a Model which usually is mathematical model.

Lets take an example of creating a Mortgage Calculator. For this you need to know what interest are, what a compound interst is and so on. If you do not have the understanding of the underlying math then someone else has to provide that information to you. Usually it is the programmer job to do everything. You can always seek help though, if needed.

There are simple concept in mathematics that are used widely in programming. For example expressions, equation, variable, they are profoundly used in programming. If you dont get it in Math, you might not be the best programmer.

Having strong mathematics, give you more stuff to model you your work on. That ultimately makes you a better programmer. For example you may want to draw a quadratic equation in one of your project, this way you learn more stuff just because you are strong in math. Or you write a program to find the area of a circle, give you more experience.

In my short teaching career, I found that if students did not have a math background, they are almost lost when doing a financial problem. If they are lost about the model, learning the language itself become more difficult and honestly very frustrating.

TheTechGuy
  • 1,035
  • 1
  • 8
  • 16
  • 3
    Whether or not someone can solve a financial problem has everything to do with whether or not they're competent in that domain almost nothing to do with programming aptitude. I work with signal processing software that contains a lot of math that's way over my head. My job isn't doing the math, it's turning what's produced by mathematicians and enginners, for whom programming isn't in their domain of expertise, into good software. Because that's _my_ domain. – Blrfl Feb 26 '12 at 18:15
  • In most practical fields, the two are separate: Someone has the model and someone has to programme it. So yes you are right. But for someone to learn programming from beginning, they have to know the math. Otherwise it will be difficult. They have to know about variable, expressions, and different mathematical properties. I have worked with optimization team. They were working on solvers. If they had no knowledge of the math, they would have never worked on it. I answered based from learning point of view and knowing that he is just a new learner who is stepping into programming. – TheTechGuy Feb 26 '12 at 18:22
  • From learning point of view it is imperative to have a math background otherwise other will be no learning. – TheTechGuy Feb 27 '12 at 20:55
  • Solvers are very much a math-domain problem, which would make it stand to reason that an understanding of the math involved would be required to work on them. I'm not saying there are _no_ mathematical concepts involved in programming, but as @DeadMG pointed out in his answer, there are a lot of very practical aspects of the process where math provides absolutely no help. – Blrfl Feb 27 '12 at 23:34
  • 1
    @Birfl, DeadMG is, well, a bit ignorant (and almost always wrong). Math would always help in all that "soft" areas. Psychology is based on math heavily. Sociology is even more mathematical. And in case of systems design, you'd better not touch it without a very good background in semantics (which is from discrete math). There are no aspects in programming that are not mathematical. GUI design and CRUD coding are included. – SK-logic Feb 28 '12 at 08:23
0

The theoretical foundation of Computer Science (which is more than just programming) is mathematical in nature. Everything from the very definition of computability to the analysis and expression of algorithms to the specifications of programming languages are all based in a wide variety of mathematics. See this Wikipedia page for a flavor of the kind of math involved.

Most of which is not really necessary to know if all you want to do is sling code. As far as applied math goes, unless you go into a field that requires serious number-crunching skills (detailed physical simulations, signal analysis, financial analysis and prediction, etc.) you're probably not going to use anything more involved than basic algebra on a day-to-day basis.

John Bode
  • 10,826
  • 1
  • 31
  • 43
0

It honestly depends on what sort of programming you're doing.

If you're making light web apps with some logic, you probably don't need the more advanced math classes that many degrees require. If you're working with things that are a bit more processor heavy, than you're going to need more math. If you're doing work with any kind of scientific field, you'll really want to keep your calc references at hand.

Another place where you'll need math is if you want to write games. The second you want to move diagonally, you'll need to start doing some careful calculations so that you don't end up with characters that accelerate if the move to a block to the NE.

That said, you don't necessarily need to learn math, then learn programming. It's perfectly valid to learn programming, then pick up some advanced math. I started coding before I ever set foot inside a Calc or Trig class and did just fine. When I did start learning advanced math, I found that coding really helped me, as I could explore the topic more by changing variables in a quick script than I could with pen and paper.

kcunning
  • 111
  • 2
  • You'll definitely need to know your trig and vector maths for games. – Alan B Apr 04 '12 at 07:54
  • Absolutely. I've also found, though, that writing games can be an awesome way to re-learn math you might have forgotten from high school, just as long as you're not on a deadline. – kcunning Apr 04 '12 at 12:03
0

I'm by no means an expert at math! I did well in HS Geometry, which was all logic to me. I find programming and geometry to be very similar. Boolean logic ties very well in my mind to geometric proofs.

Then there's little things like knowing that you can control how many columns are in a row using the modulus operator.

I strongly favor the idea of being a good programmer who has a friend (or colleague / consultant) who is a good mathematician.

Obviously if you're blessed to have both skillsets, run with it!

TecBrat
  • 331
  • 1
  • 12
0

Simple answer; Math makes you fast. Sure, you can google/se/wikipedia your coding problems away, but get enough math done and you won't need to. Believe it or not, the properly trained human brain is faster than google. Moreover the more math you know the faster you will be able to understand the results google/se/wiki gives you, and the less you'll need to drill down to understand what people tell you. In the process of solving your programming problems you'll end up learning math anyway but if you focus on math it will be a far more efficient process.

Your question is kind of like a rock musician asking why they would need formal musical training. Is it possible to be successful without it? Sure. Does it make you much more of a badass if you do go with it? Absolutely.

Slightly more complicated answer - When mathematicians and programmers use the word "solution" (for problems, that is, not equations - ie not "roots") - they mean pretty much the same thing. Learning to solve math problems helps you to learn to solve programming problems.

BTW - and no offense intended to anybody whatsoever - anybody who says s/he is a good programmer but s/he hates math is a Big Fat Liar. What happened was, they got turned off of formal math by a bad hs or college instructor and ever since then they feel like they "aren't good at math". Anybody without a learning disability (ie anybody capable of learning an OO language) is capable of everything up to and including Sophomore Calculus.

jamesson
  • 537
  • 1
  • 5
  • 14
0

The actions of doing Mathematics and 99% of Programming have very little in common. Math is not required to be a great programmer. I've taken several college level courses in math, including but not limited to Calculus I,II,III elements of linear algebra, and several others.

I've been a software engineer for over 10 years and only rarely needed to use anything more than basic mathematics. There are some exceptions where mathematics is needed: like graphics and other areas. But 99% of the programming and software engineering doesn't require Math. It requires logical thinking, algorithms, OOP, functions, decomposing problems, etc.

0

1) As you learn programming, you will come across technical jargon(i.e., algorithm). To analyse algorithm, one has to have an idea about the nature of polynomial, logarithmic and exponential functions.

2) Based on a computer science application, one has to have an idea on discrete maths and continuous maths to write meaningful solution. One can understand more on this by going through such courses like-

---> Mathematics for Computer Science

---> Coding the Matrix: Linear Algebra through Computer Science Applications.

For a beginner, I feel dynamic typed languages like python/scheme are the first best languages for programming. Static typed languages like Java/C++ are not the best to start with. Opencourseware published from "MIT/UOC-Berkeley/Stanford" can guide you better than a regular college curriculum. I bet you!!!

overexchange
  • 2,245
  • 2
  • 17
  • 47
-1

I would personally say, it depends upon the level of programming that is involved. The data models and the correlations between those, the programming algorithms involved. For eg: to write a program that outputs "Hello World", i see no requirement for familiarizing someone with Higher Mathematics. The level of Mathematical involvement would depend upon the level of complexity of the problem that needs to be solved programaticaly.

Aubede
  • 1
-2

Someone almost hit the nail on the head above. Programming is mathematics. More specifically, programming is a branch of mathematical logic called computability theory or recursion theory.

Other branches of math are involved directly, specifically formal language and automata theory. These help describe regular expressions, used in pattern matching, and formal grammars, used to describe and parse programming languages.

Anybody who says that programming is not mathematics either doesn't know what they're talking about, or has an ulterior motive, like a "Intellectual Property" maximalist, who hopes to profit by getting a patent on an algorithm or some other basic mathematical fact or discovery.

Some references for programming as math, and the corollary not knowing what you're talking about:

Program are Proofs: 19th Century Logic and 21st Century Computing

Programs are Proofs: Models and Types in Lambda Calculus

Wikipedia's Curry-Howard Correspondence article

On the Unusual Effectiveness of Logic in Computer Science

The Unreasonable Effectiveness of Logic

Yes, those are heavy on the "logic" part of mathematical logic, but mathematics is generally acknowledged to be a few axioms, and their logic consequences as developed via first order logic.

As far as saying otherwise and being an "IP" maximalist out for money:

How to patent an algorithm in the US. Algorithms aren't patentable, but patents are granted on algorithms by not referring to them as algorithms. It's not hard to find a lot of material on the web that either points out, or attempts to explain, that contradiction.

Bruce Ediger
  • 3,535
  • 16
  • 16
  • 6
    -1 for the ad hominem at the end. – Charles E. Grant Feb 27 '12 at 00:57
  • @charles ad hominem against whom? The original poster? I think the point about patents is insightful (even if it could have been phrased better). – gcbenison Mar 30 '12 at 15:40
  • @gcbenison, "Anybody who says that programming is not mathematics ... or has an ulterior motive" is a classic ad hominem attack: I don't have to respond to your argument because you are a bad person. I found it irritating because I don't think programming is math, *and* I think software patents are an abomination. I do have an MS in Applied Math, though whether I know what I'm talking about is certainly open to debate. – Charles E. Grant Mar 30 '12 at 16:56
  • @commentators : thanks. I use to ignore those behaviours because they are self projected misery imputed on others. --- to Bruce Ediger : Doubt sign reflexion in progress. – cl-r Apr 02 '12 at 15:34
  • @cl-r: I was thinking of very specific examples, like the SCO anti-Linux campaign, and http://www.nature.com/news/us-supreme-court-upends-diagnostics-patents-1.10270 If we as programmers let lawyers define mathematics to lawyer's benefit, then we do all of civilization a great disservice. – Bruce Ediger Apr 02 '12 at 20:56
  • @ Bruce Ediger. It is a USA problem, more weak in Europe. Market an banks want to manipulate property's laws against personnal freedom, or to spoliate biodiversity of poor countries. It is not only a mathmatic problem. OpenSource (and all such movments) have to fight against those deleterious concepts. But this battle will gain only if no emotional behaviour can be pointed out by your ennemies. If mathematic(ians) make alliance with all others humans concerned, victory is possible. -- It is just something pick out from my *intuition* and my *logic*, not from my poor ability in mathematics. – cl-r Apr 03 '12 at 07:25
-2

Just my experience, no more :
I'm not mathematicien. I'm not a genius, just a autodidact.
... and after many years, I realize than I work with intuition

First I learned Pick (dead system) from scratch (alone with paper documentation and samples),
... after C, C++ for fun, and Java for work.

As you told about it, I can say that learning this language is not a mathematical problem (even if basic/minimalist algebra help you,) but a logical one.

Now many tools (like Eclipse) help and correct you : you have to focus to what you want to do, with only 52 reserved words ... and many libraries which have down work for you.

So if you like language, choose a Java project, study Pattern Design, UML, understand JVM and how use it with Bigloo and Scala, understand again and again during 10 000 hours.

Experience in Java give you well paid jobs, and for a long time in industrial big projects, and you will be able to switch to another environment because you are able to speak informatic, not mathematic.

If understanding language (words, meaning, concept and other hided logical sciences like semantic, ontology, ..) is a good objective for your human person, for all your life, you can begin now.

Otherwise, experiment another way.

Best regards
Claude

cl-r
  • 127
  • 5
  • Again, see below post. You are doing math, you just choose not to admit it. – jamesson Mar 11 '12 at 23:42
  • 1
    I saw, but I've found also other posts responding to the first question about mathematical interest for a student (who know basis, not specialities) with -1^n when they told about logic in latin, philosophy, language ... real life. Is mathematic give mind so confined that all is not in equation is rejected, without understanding life around, and forgetting that Newton begin with an intuition given by an apple? Perhaps it is to moderator to open minds to the other worlds, when possible, this will enrich the both side of the discussion. Notherless I'll be carefull in my write. – cl-r Mar 20 '12 at 14:29
-2

Mathematics is everything to do with programming. For example, in game programming you need to use matyhs for the physics and to do more less everything. To move the player's x position in Java you would do int x = x + speed * deltaTime or int x = x - speed * deltaTime But you might say that that is basic maths so lets move onto more advanced stuff. There is an algorithm for rating chess players called the Elo Algorithm.

This is the Elo Algorithm Explained

If you still think that this is basic then try this. How do you calculate someones age when you are given a birth day, month and year. Subtract birth year from this year and then check if month is less than this month and if it isn't subtract 1.

It isn't magic it is hard work and good mathematics.

one2three
  • 1
  • 8
-4

Ok, I'm probably going to get a ton of down-votes for this, but programming and maths are two completely unrelated things. Someone can be an amazing developer knowing only the basics like addition, multiplication and basic logical operations.

Most of the developers will not solve a single equation during their professional career, and things like big O notation can be grasped in non mathematical way as well. You just think about the stuff, imagine bits flipped in your head, and voila, you can tell what kind of big O the stuff is, if someone explains what log and power is.

Sometimes math can make it simple, or it can make you feel proud that you proved something, since you can extend the meaning of programming to a mathematical domain via naming it discrete maths and such, but learning a lot of differential equations and integrals, and how to prove that, is IMHO not exactly the best idea what to do if you want to succeed as a programmer.

At least I haven't touched the maths for 10 years, I had arguments with my math professors all the time, and when I needed a math for realtime rendering, I learned everything from programmers side of view, without any proving any theorems, and for me it was simple and easy to grasp compared to all the stuff math professors where putting in our heads with a comment of "you can't be a good programmer if you don't know the math". Sure you can, easy!

I now know the mathematical stuff, so that I can talk with math-background programmers with all the log's differentials and stuff, but only for the reason so that they wouldn't faint. Because that stuff is useless 99.9% of the time, and when it is, it can be learned 1000x more effectively from programmers viewpoint.

Heck, programmers need at least 5 years to master a programming language+frameworks+best practices. Why on earth they should learn how to prove the theorems? Math student's do the math stuff, programmers get that stuff running, that's how it should work.

Coder
  • 6,958
  • 5
  • 37
  • 49
  • 8
    A kid tells his mom that he won't need maths coz he's gonna grow up and be a millionaire baseball player. His mom tells him "You'll need maths to count your millions". – Nav Feb 27 '12 at 03:01
  • 2
    Sorry, I have to disagree. Studying math teaches you how to think logically. If you can't think logically, all you're going to write is a bunch of code that doesn't scale. I'm not saying you have to be an expert at math or even like math, nor must you use it in your everyday life. But you do need to study it if you want to solve real programming problems. – jmort253 Feb 27 '12 at 05:18
  • @Coder, mathematics is not about the numbers and such, as you probably may think. Arithmetics is a tiny, nearly unimportant bit of the mathematics. Programming is made of a pure math: programming languages are mathematical constructs, the very way of translating a thought into a formal system (i.e., into a program in a formalised language) is entirely mathematical, reasoning about complexity and semantic equivalence is nothing but math, and the very logic on which all this stuff is based is nothing but math. As for your "five years" - this is only applicable to the very, very bad programmers. – SK-logic Feb 27 '12 at 08:12
  • You have to study to master programming. You may have ease for thinking logically without studying (which may make you Learn the theory). I think Coder wrote about future (or already was) for some developers. Even if the amount may be small. – Independent Feb 27 '12 at 11:18
  • 2
    @jmort253: Studying math doesn't make you into logically thinking person. It's either something that's wired into your mind, or not. I've hated the math since school, but I'm very logical person. Programming is not maths, I'm into systems programming for 10+ years, and I can tell that with 100% confidence, and you can expect even less math when you're into web development or SQL administration. Your task is not to develop new mathematical theories, your task is to get the stuff working using limited resources in maintainable way using most efficient algorithms and containers. – Coder Feb 27 '12 at 19:38
  • 2
    @Nav: It makes sense for every person for basic math, up to equations with x and y. But counting your millions is usually what accountants and lawyers do, because otherwise you'll miss some state law that has to do something with declaration and loose everything either way. You should be smart enough to understand what's going on, but once you excel at something, it's more cost effective to use specialized services that will do stuff for you correctly, fast and on time, while you're keeping your shape in the gym, to keep that hard earned top 5 spot. – Coder Feb 27 '12 at 19:43
  • 2
    @Coder - I think you and I might have to agree to disagree. I've personally done some programming tasks that had nothing to do with math, but loosely reminded me of something I did in Integral Calculus, and I'm a Web developer. I can see your point that logic is an innate quality, but I also believe to some extent that this innate skill needs to be exercised and unlocked. Even you my friend have studied math, and perhaps that helped you in ways you just haven't thought about because of your disdain for math :) – jmort253 Feb 27 '12 at 19:56
  • 1
    @jmort-I partially agree with your response to Coder. If you know math well, then magically you find ways to use it to make you more efficient quite frequently. If you don't know math well then there are usually other ways to get the job done, be it brute force or whatever. However, the interesting thing about this forum is the diversity of work between the different developers. It shows that while we call ourselves basically the same occupation, our jobs are frequently only related in that we sit in front of a computer and write code. Nothing else is similar. – Dunk Feb 27 '12 at 20:59
  • 1
    Thus, while many people find math essential to do their everyday job, even if on the surface their product doesn't seem to contain much advanced math. There are others who never have and never will need math beyond the bare bones basics. So the end result is that you are both right. You find uses for the math. Coder has no need for it. But I'll bet Coder would be surprised how valuable it would be if they made an effort to find applications of advanced math in solving his programming problems. – Dunk Feb 27 '12 at 21:02
  • I have a masters degree in cs., which involved a lot of math, so I would see where it applies, and that's a tiny fraction, ~0.1% of tasks at best. And when I need it, it's easier to look up stuff in wikipedia, since I've forgotten most of it, rather than trying to figure out a formula + proof. And when it comes to big O 'maths', the logical thinking gives the same results as 10 years of advanced math courses. – Coder Feb 27 '12 at 21:42
  • 10
    Mathematics is not the process of solving equations. If the only mathematics you've ever seen is the mathematics taught in school, you have never seen [actual mathematics](http://www.maa.org/devlin/LockhartsLament.pdf). – doppelgreener Feb 28 '12 at 07:01
  • 1
    @Coder, SQL is nothing but math. How can you even touch it without knowing a relational algebra or, more, a basic set theory? There are only two options: either you're doing a lot of math without even realising it, or you're not a good programmer at all. No other alternatives. And please, do not refer to your "masters degree", it is pathetic if you still unaware of an obvious fact that math is not about the numbers, it is much bigger than that. – SK-logic Feb 28 '12 at 08:29
  • @SK-logic: This is going nowhere because we use different meanings of math. I don't argue that everyone should know high school math, although even that is often times wider than what's needed in software development. I'm arguing about higher-math as it's called over here, with a bunch of stuff that only math students should learn. Theories, provings, etc. SQL set theory, common, you can explain SQL for a person who knows computer memory model in 15 words. It's like connecting dots, why on earth would you want higher-math proofs like www.cs.uiuc.edu/class/sp09/cs173/Lectures/lect_12_supp.pdf? – Coder Feb 28 '12 at 15:34
  • 1
    @Coder, there is a single common definition of what mathematics is. Yours is wrong, mine is ok. You only count boring things like calculus and arithmetics as math. The rest of this planet would include logic, proof theory, formal languages, graph theory, combinatorics, set theory and all that fun stuff into mathematics. Even more - they form the very base for mathematics itself, without them you won't get your boring calculus or trigonometry defined. I suspect you're misusing SQL really badly if you think you can get away without relational algebra. – SK-logic Feb 28 '12 at 15:39
  • @SK-logic: If you're a developer, your task is to get the rest of the planet working, not proving how it works. And that's why Wikipedia exists, you look up the formula and you implement it into the solution. As a developer, you're better of by learning how generic programming works, what are the patterns for problem solving, etc. Not learning how to prove some ancient theory, which is never done again during your day job. You use construct from higher math, not prove them, just like physicists do. Why on earth would you want to prove how Quaternions work? Someone did that, use the result! – Coder Feb 28 '12 at 16:05
  • @Coder, have I ever mentioned proving anything? Probably you do not know it, but every time you specify a function argument or a variable type you're creating a theorem and you're asking a compiler to prove it for you (see *Curry-Howard isomorphism*). Besides that, you rarely have to prove anything. Looks like you're still failing to understand what the mathematics is and what it means to solve mathematical problems. Programming is nothing but solving mathematical problems, and proving a correctness of a solution is not required. – SK-logic Feb 28 '12 at 16:13
  • @SK-logic: Well, proving theorems and stuff was the main curriculum for software developers in our universities. A total waste of time IMHO. – Coder Feb 28 '12 at 17:13
  • @Coder, it's rarely useful, but there are cases when you'll be much better off if you're comfortable with it. Have you ever tried programming in Coq or Agda? If not - I'd recommend you to try, it might well be the next big thing. IT industry is evidently climbing up the *lambda cube*, so it's better to be well prepared. – SK-logic Feb 28 '12 at 17:17
  • @Coder-Being that your math curriculum was probably taught by the math department, it would not surprise me that teaching proofs in introductory math courses is a part of the process. For one reason, there are probably potential math majors in the introductory course. Second, it is frequently useful to know WHY you are doing what you are doing, as opposed to blindly accepting what the book tells you without having a clue how they arrived at the formulas or techniques. For many people, that is useful, it means they don't have to remember it, if they can derive it themselves. – Dunk Feb 28 '12 at 22:24