8 ms·
Ask HN: What are some important math topics every programmer should know?
I'm a self taught full stack developer who's flunk out of high school and did not have the chance to study "advanced" maths such as calculus, statistics and probability.
In 10 years of experience I never felt the need for any of it, and a recent contract requires, for a simple feature, the basic knowledge of derivatives (given a polynomial curve, graph it in a dotted line when it falls off from the local maxima).
I've started catching up on courses on Khan Academy and having a great time. My question is, which math (or physics) knowledge have you actually used in your programming career, and think it's mandatory for software engineers to know?
PS: If anyone from Khan Academy is reading this, thank you for your project, you're doing a great service for humanity.
- ColinWright 11y agoI've used a lot of math in my work. But the point is, I have a lot of math to use. So many people say "I've never used math" or "Oh look, another day without using algebra," but really what's happening is that they don't realise that there are times when they can use mathematical thinking and techniques. It's blub all over again. So to be specific, I've used calculus in a bunch of places, Linear Algebra, Markov Chains, Quaternions, Topology, and Graph Theory is just everywhere. It's impossible to make recommendations - there's far too much, and what you need to do is get started on something, and keep track of things that look like they'll be interesting, useful, or the basis of something needed. In part this is why I've started the "Topics In Maths" project I'm working on. So good luck - keep pursuing stuff, and I hope you get more and more intrigued by what you find.
- RogerL 11y agoThis is really important. I've seen so many people just thrash at problems because they did not have the math to solve it. It's not so much that they didn't take the course or whatever, but that they didn't even understand that there was a systematic way to find the answer. You almost can't be a programmer these days without knowing about data filtering and validation. And I can't tell you how many ad-hoc ways I've seen people try to filter data that was worse than useless - it harmed the quality of the data. So, linear algebra, robust statistics, optimal and non-optimal estimation, and some classification theory will take you a very long way in many jobs. If this isn't clear - PageRank (the original google search algorithm) is just applied linear algebra. Netflix recommendations? Linear algebra. Spam filtering? Bayesian filtering. Medical imaging? linear algebra, Bayesian filtering. It goes on and on. Math is not mandatory to be in the field, but there are a vast number of really interesting jobs which you have no hope of doing without a fair amount of math. This is why I feel so sad when yet another "college is for suckers" thread starts on HN. It takes a lot of concentrated work and practice to develop the math skills and to learn to apply them, and college is the last chance you have to do that in a concentrated way. You just might learn about eigenvectors and invent the next PageRank! graycat always has interesting posts about how he has used in his career - do a search.
- j2kun 11y agoLinear algebra also allows for things like Facial recognition, error correction/detection, linear programming optimization, signal analysis, graphics, machine learning, quantum computing... The list just goes on and on.
- adamtj 11y agoCan you give some examples of problems you've solved?
- ColinWright 11y agoBriefly, tracking small radar targets in sea and rain clutter, compressing radar and audio streams, classification of radar signatures, classification of vessel behaviour, and more. I can't go into too much detail because it's all commercial in confidence, but those are the sorts of things I've worked on most recently.
- yen223 11y agoIf you don't have a hammer, nothing looks like a nail.
- brudgers 11y agoGraphs.
- 1_player 11y agoGood call.. I had to learn them when I was building a Bitcoin arbitrage bot, and how to implement the Bellman-Ford algorithm. Also, any game programmer worth his name needs to understand them for pathfinding algorithms (A*, Dijkstra, etc.)
- brudgers 11y agoWhat is a program but a directed graph?
- deleted 11y ago[deleted]
- veddox 11y agoYes - brings to mind computational/systems biology, where you have plenty of networks to analyse (gene expression, protein interaction, etc.)
- mcdevhammer 11y agoDepends on the industry I suppose. I work in the financial industry and I have used linear algebra quite a bit and graph theory as well. I would say linear algebra in pretty important as it is also used heavily in graphics/games.
- Someone1234 11y agoEvery programmer should know? None. Middle school maths is "good enough" for the majority of programming jobs (85%+). There are of course niche programming jobs in: finance, statistics, AI, CS, gamedev, and so on but if you look at the programming industry as a whole those jobs are a tiny proportion overall (the majority are "boring" enterprise-style developers and web-developers: Java/Tomcat, ASP.net/MVC, PHP, RoR, and so on). The thing is that the "boring"/average programming jobs are the silent majority. You'll likely read in this thread tons of obscure topics and how they apply to obscure jobs, but the reality is that few programmers work in those industries, but nobody [else] is going to post just to admit that for their job they don't need any maths day to day because it is boring and redundant. This is JUST my opinion, but if you want to learn obscure topics, you're better off spending time learning CS topics (e.g. floating point number representation/bugs/limitations, encryption/hashing/etc, binary representations, assembly, kernel inner workings, CPU inner workings, and even borderline electronics). While advanced maths has a place in some jobs, advanced CS topics seem to be useful even on the web-stack/enterprise-stack to understand where bottlenecks might be materialising. Maths is not useless. But most programmers won't use a lot of it day to day, if for no other reason that they have a library which does it for them (and they'd be foolish to reinvent the wheel).
- fweespeech 11y agoI'd say its really high school math. There are a number of concepts I use from 9th-12th grade math on a regular basis [e.g. DeMorgan's laws was in 12th grade iirc, most of the Algebra I use was also from 9th-10th grade] and I'm not in any of the niches you mentioned or any of the niches I'd consider "math heavy". I'd agree that college math is really only relevant to specific niches in the industry but I think the niches are larger than you mentioned. [e.g. Distributed systems, flight guidance]
- cortesoft 11y agoI think you might be using more math than you realize. You might not have LEARNED about it in a math class, but it is math. Set theory, statistics, etc.... I know a lot of what I do involves those things.
- baby 11y ago
- fartbrain 11y agoI work in digital advertising (sorry, world), and use linear algebra often. ... I suck at it, so I usually get somebody with a math degree to help me out.
- panic 11y agoLike other commenters have said, it depends a lot on what programs you're writing. You might want to know some harmonic analysis if you're writing audio software. On the other hand, if you're making user interfaces, knowing a little bit of geometric math (vector algebra, trigonometry, calculus) can go a long way.
- serve_yay 11y agoDeMorgan's laws. (You'll probably end up negating a boolean expression at some point. Don't screw it up!)
- 1_player 11y agoAll the comments in this thread are really useful (thanks, everybody), but you finally gave me a name for something I badly need when refactoring overcomplicated "if" expressions. I usually get a pen and paper and write the truth table by hand to understand how to simplify the logic. Thanks!
- meeper16 11y agoBottom line: You're constructing and executing math and likely do not realize how much math you are constructing and executing on a daily basis. This includes formal and experimental advanced theoretical mathematics, probability, statistics and number theory in some cases. Some academics do not like to hear this, however, you deal(industry term) in functions, variables, minimums, maximums, rates of change, statistics, probability and overall, symbols. If you're duplicating the next facebook (as facebook did with myspace and myspace, friendster, etc etc), snapchat or yo app your likely not directly engaged in much math or innovation compared to inventing something on the algorithmic level like Google. If you are creating or inventing something new on the software engineering level including the algorithmic level, then you are certainly creating a lot of theoretical math and perhaps without even knowing it. This is key. Here's a good book to understand how you've leap-frogged certain aspects of mathematics via true and real innovative Computer Science: (the Einstein of India. Every country and family has their very own Einstein, you might be one of them.) The Man Who Knew Infinity: A Life of the Genius Ramanujan http://www.amazon.com/The-Man-Who-Knew-Infinity/dp/0671750615 http://www.amazon.com/The-Man-Who-Knew-Infinity/dp/067175061...
- bbcbasic 11y agoBinary numbers (1010 it's off to work we go!) Boolean logic. How numbers are encoded in binary. How ints, doubles, floats, etc. work under the hood on a computer. Can be learned on the job.
- gcanti 11y agoset theory, equivalence relations, partial and total orders, algebra (monoids, lattices, ...), graphs
- Bahamut 11y agoI find understanding of symbolic logic to be very important. For UI programming of any sort, an understanding of basic geometry is very important, including graphing. There have been times in my short career where I have had to implement pixel perfect renderings due to the types of problems that were being solved.
- echeese 11y agoSometimes I feel like I should have paid more attention in class, like when looking at an expression and wondering if it could be simplified or if all the parens are really necessary
- fsk 11y agoStarting with the easiest: boolean logic, boolean algebra What does O(n) mean? The compound interest formula matrix/linear algebra, numerical analysis The statistics behind A/B testing numerical approximation of a derivative, integral, differential equation Read "numerical recipes in C"
- jerf 11y agoHigh school and even undergraduate college gives you a rather late-19th, early-20th century view of what "math" is. A lot of math doesn't involve "numbers", per se. So, as a programmer in your self-described situation, my advice is to work through the math in Structure and Interpretation of Computer Programs [1], commonly referred to as SICP, and to do so seriously. Does it not feel like math? That is, alas, a deficiency in your education, but don't feel bad, it's a deficiency in most people's education. It's math, and directly applicable to what you are doing in life. Now, these other suggestions are fine too. But I find it to be very, very practically useful to be able to take apart the very concepts of computation, and thereby learn how to reassemble them to suit my whims, and not be swept away by the fads of the day. The SICP is a concentrated load of exactly what you missed out on by not getting a formal computer science education. I honestly would likely prefer someone with 3 or 4 years of industry experience and the ability to prove they really worked through the SICP (not just read over it once, but worked it through) over someone with a 4.0, a bachelor's degree, and nothing else. [1]: https://mitpress.mit.edu/sicp/full-text/book/book.html https://mitpress.mit.edu/sicp/full-text/book/book.html
- loumf 11y agoMy first two jobs out of college were in FinTech -- lots of math there (partial derivatives, linear algebra, numerical analysis methods, stats and more) Then later, I was in image processing -- a lot of linear algebra. Anything with recognition has mathematical concepts. I'm tutoring a teen in game programming and keep having to take breaks to teach more and more trig. Having a good grasp of probability and statistics will serve you in almost anything you do.
- rcheu 11y agoThere's a course at MIT called Mathematics for Computer Science (6.042). It's available on Open Courseware, http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-042j-mathematics-for-computer-science-fall-2010/ http://ocw.mit.edu/courses/electrical-engineering-and-comput...
- Animats 11y agoYou need much more math to survive in the field beyond the appcrap/webcrap level. Here's the description of a 3D SLAM library for robotics. This is what looks at an image from a moving camera and builds a map of where the camera is and of its surroundings. "RobotVision is a library for techniques used on the intersection of robotics and vision. The current version (1.1) comprises bundle adjustment, feature initialisation pose-graph optimisation, and 2D/3D visualisation among other things. The bundle adjustment class follows the classical approach - the first order sparseness structure is exploited using the Schur complement. However, compared to other straight-forward implementations, it has the following features: The second-order sparseness structure -- not all landmarks are visible in all frames - is exploited using sparse Cholesky factorisation (using the CSparse library). Optionally, the implementation supports the use of robust kernels in order to guard against spurious matches. Also, the implementation generalises over different transformations, landmarks and observations using template meta programming. Among others, SE3 pose transformation with 3D Euclidean points and 2D image observations are provided as a default implementation for monocular SLAM. Furthermore, the bundle adjustment class also contains an information filter for inverse depth feature points which can be used efficiently for feature initialisation within a keyframe-based monocular SLAM framework. The pose-graph optimisation framework is using Levenberg-Marquardt, whereas the sparse Hessian is dealt with using sparse Cholesky factorisation (CSparse). Again, it generalises over different transformations. Apart from the standard rigid transformation SE3, it also supports 3D similarity transformations Sim3. In other words, it can also deal with scale drift which occurs in monocular SLAM. Both, the bundle adjustment class as well as the pose-graph optimisation class uses Lie theory. Poses transformations (SE3, Sim3) are represented on a manifold/ as a Lie group while incremental updates are done in the tangent space around the identity/Lie algebra. In this way, we achieve a minimal representation during optimisation while ensuring that we are always far from singularities."[1] That's only some of what it takes today to do robotics. The world is about to change. Tomorrow, everyone will discover that powerful humanoid robots are here.[2] [1] https://openslam.org/robotvision.html https://openslam.org/robotvision.html [2] http://www.theroboticschallenge.org/ http://www.theroboticschallenge.org/
- kvcc01 11y agoI work in quantitative finance and find that basic probability and statistics help a lot in this field. In fact, they are almost like prerequisites for hiring. That said, I think everyone would benefit by reading a bit about these subjects, whether or not they’re developers. We seem to have a built-in tendency to underestimate the effect of randomness in life (see Fooled by Randomness and How to Lie with Statistics). To counteract that, I find statistical methods (e.g., hypothesis testing, confidence intervals, etc.) to be very useful tools to keep in mind. Having basic familiarity with such tools may not necessarily make us better programmers but it'll probably make us more rational decision makers in the general sense.
- justonepost 11y agoAi/data sciences uses a lot of partial derivatives, linear algebra, etc
- logfromblammo 11y agoEvery programmer should be able to convert between decimal, binary, and hexadecimal notation, and be able to understand the bit-shift and bitwise operations. That's it. Programming is too diverse a field for any one branch of mathematics to be required for all of them. Many fields require linear algebra, geometry, trigonometry, graph theory, and discrete math. Graphics and 3D-modeling programmers will need to know matrices (possibly also quaternions) and vector math. You may also need screw theory and geometric algebra. Engineering support will need to know calculus. AI will need probability. Scientific support will need statistics. Cryptography will require all the maths that exist, plus some that haven't been invented yet. Business support will need to know sexagesimal math--for the clock-watching. You will really need to know when 5:00 rolls around, so you can stop working on your stupid CRUD app. In short, the more math you know, the more likely it is that you will able to apply it to any given program. And the more you know, the easier it will be to pick up something you need and don't have already. Practically speaking, you are better off seeking a shallow knowledge of a broad array of disciplines, and deepen your knowledge of specific topics as needed. If you know imaginary numbers, that makes it easier to learn about duals, quaternions, null vectors, spacetime manifolds, and such.
- DIVx0 11y agoThe jobs I've held have not been particularly 'mathy' but knowing linear algebra, numerical analysis and statistics have come in very handy over the years. Knowing how to 'read' math has been helpful digesting Computer Science papers too.
- viggity 11y agoBest math class I took in college was discrete math, it is extremely applicable to computer programming. http://en.wikipedia.org/wiki/Discrete_mathematics http://en.wikipedia.org/wiki/Discrete_mathematics Highlights include Combinatorics, Set Theory, Graph Theory, etc. Great stuff, I liked it so much I kept the book even though the book store offered me $80 for it.
- davnicwil 11y agoIn the first year of my CS degree we studied some rudimentary CS-related mathematics. Some of it I barely used beyond the exam, but there are two topics which rise high above the rest in terms usefulness when working on real-world web apps. Set Theory: http://en.wikipedia.org/wiki/Set_theory http://en.wikipedia.org/wiki/Set_theory and Combinatorics: http://en.wikipedia.org/wiki/Combinatorics http://en.wikipedia.org/wiki/Combinatorics I can't tell you how useful these branches are in terms of the indirect and direct positive influence they have your thinking about how you organise and process data. Which at the end of the day is the core work of most web apps. Even the very basics will help you greatly, remember I'm talking about first year CS courses here!
- mathattack 11y agoThe tough part here is "every programmer should know" as there are very few universal "Must Knows". Much of CS theory is math so there is a lot to be said for "You're learning Math whether you think so or not." Some general comments on math topics: Partial Differential Equations - Useful for financial technology and engineering applications. Statistics - Extremely useful in financial technology and marketing applications. (A/B testing, etc) Also good for having an informed worldview. Regression Analysis - Same as Statistics, though less important for having an informed worldview. Logic - Whether you call it Philosophy or Math, it's useful in hardware, formal verification, and general thinking. Linear Algebra - Good for financial technology and machine learning. Set Theory - Good for understanding databases. Number Theory - Useful for cryptography. Graph Theory - Great for networking, and algorithm thinking in general. Theory of Functions - Good for understanding recursion (LISP, Scheme, etc) and functional programming. Does anyone need to know all of this? No, but learning the math behind whatever niche you choose will make your intuition and thinking stronger. I think Stats is the only general purpose math that everyone should understand as part of being a critical thinker.
- chris_wot 11y agoLogic and set theory are intertwined.
- BasDirks 11y agoSet theory and everything are intertwined.
- ska 11y agoCategorically.
- mathattack 11y agoA lot of these are. One beauty of math is ideas from one part percolate into others.
- 11y ago
- bkjelden 11y agoSet theory & basic boolean algebra (De Morgan's laws, etc).
- petewailes 11y agoBackground: I do a lot of work with apps at scale, so dealing with really big sets of data, and doing maths on it. With that in mind, I'm biased towards the maths that I use, but I'll try and be broader and as unbiased as I can be. 1. Statistics. There's so much you can do with a really solid understanding of the basics of statistics, it's silly. It's massively helpful with things at scale where you get into difficult caching challenges, systems with multiple data sources and estimating data accuracy, informing based on partial or sampled data... Really useful stuff. 2. Geometry. You'd be amazed how many problems there are that exist in n dimensional space. A good grounding in geometry will let you understand how lots of systems work. For instance, autocompletes tend to be solved nowadays by calculating distances between input shapes and words in n dimensions, where different stopping points add an extra dimension. Also really helpful when you start dealing with complex data systems. 3. Interesting algebra. Mostly if you understand code, you'll pick this up pretty quick. Lots of philosophical similarities. Beyond that, it depends on what fields you want to go in to as you can get really specialised. But whatever you write, knowledge of those three will always be handy.
- bencollier49 11y agoModular arithmetic. Big-O notation.
- IndianAstronaut 11y agoUnderstanding stochastic processes has helped me quite a bit in my data mining career.
- aout 11y agoDon't learn anything specific but be sure to be ready to learn everything when needed. I had to learn linear algebra when I was a 3D engine developer, then I had to learn statistics (or maybe learn to understand the notations of it so I could use scientific papers in my work). In the end I think it was best not to have lost hours, days, weeks of my time on things I "could have used". I find it best to be prepared to learn anything.
- logicallee 11y agoWell, a lot of computer science literally belongs to math, as in, is a strict subset of math. (Including the words I just said, see, about subsets.) Specifically, a lot of computer science belongs to "discrete mathematics", (because there are discrete states not a continuous interval of possibilities, but still math). so even for everything where you thought you were just learning computer science - when you look at sorting, trees, big-O complexity, correctness, graphs, one-way functions, lexical parsing, network theory, control systems, error handling, compression, etc, you're really just ... straight-up doing math, by definition. (or using a library, compiler, operating system, network stack, database engine etc, etc, etc, by someone who has.) I mean that it is literally the field of mathematics. Like when you remove two 'not' in a row you are just straight-up literally doing math. So firstly, I would say that these are just some of the things that are directly used by people practicing computer science, even if only second-hand - http://en.wikipedia.org/wiki/Discrete_mathematics http://en.wikipedia.org/wiki/Discrete_mathematics - As well as the more specific, Oh, I heard it's impossible to evaluate whether a function will terminate... oh...I heard you can't compress random data at ALL on average... oh the shannon limit means we could never get that much data across this channel... wait, can you get the signal back after a fast Fourier transform - of course! that's what an inverse fourier transform does.. ... can a simple regular expression match if parentheses are matched and only correctly nested - answer: not a REGULAR one - http://stackoverflow.com/questions/133601/can-regular-expressions-be-used-to-match-nested-patterns http://stackoverflow.com/questions/133601/can-regular-expres... etc. etc. you see this stuff everywhere. but you just look it up and do it - well, it's math! basically all of the 'theoretical' stuff is. so it's not so much about finding parts of 'math' that a computer scientist should know...it's about realizing that most what you use (right down to boolean logic) is strictly math to begin with. you're literally (not metaphorically) doing math every single day, all day, every time you negate a boolean before returning it. reasoning about database opreations? straight-up set theory. so it's like your real question is, what is the math that I would find useful if I learned it? And the answer is - as a computer scientist, "computer science" is the math that you would find useful if you learned it . . . the other stuff, like geometry or calculus, is interesting but a red herring - in a way they could be considered the application logic. your calculus equations are only useful if your functions implementing them bother to ever return a value... you can hardly write two loops without at least thinking about time complexity. bam, math. all the rest of computer science is math too. everything you do every day. it is just part of mathematics. so go ahead and learn more math - what part? the "computer science" part :)
- j2kun 11y agoI'm deeply devoted to mathematics, and even I admit that you don't need any math beyond boolean logic and arithmetic to have a successful career as a programmer. The rest of this comment is a pitch. All that being said, I have found that a little bit of math makes programming way more fun. I've been writing a blog called "Math Intersect Programming" [1] for four years now, and it's turned into a little catalogue of cool things you can do with math. While linear algebra suffices for a lot of these applications, the rabbit hole goes pretty deep past calculus and basic statistics. The central skill I've found useful is simply learning to read mathematics in a productive way (it's not like any other kind of reading you've ever done before, though if pressed I'd say it's closest to reading dense software documentation). In image processing, you can cleverly manipulate graphics [2], make "hybrid images" [3] and digital watermarks [4], and do procedural content generation [5]. While we all know graphs are ubiquitous in algorithms (searching, ranking, data structures, etc), you can also do fun things like finding communities [6] and turning "hard" computational problems into neat games [7] (or vice versa). You can do cryptography and cryptanalysis [8], hunt serial killers [9], share secrets [10], compute cheap and healthy diets [11], design markets [12], detect and recognize faces [13], and all sorts of other things (my blog just has examples I happen to think are fun, ignoring many examples that are actually lucrative). More generally by studying math you learn to tell what problems should be attacked with what tools. You learn that any time anything exhibits symmetry it should be studied with groups [13]. Or that with some elbow grease you can solve lots of problems (like register allocation) by doing graph coloring [14] or linear programming [11] or some basic Fourier analysis [15]. The more you learn the more you get to think about, like "the shape of data" [16]. And before you know it you're like me and you think algorithms with elegant mathematical analyses are beautiful and worth studying for their own sake. You give up your overpaid software career, get a PhD in math, and wonder if you'll ever have enough time to learn everything you want to know. [1]: http://jeremykun.com/ http://jeremykun.com/ [2]: http://jeremykun.com/2013/03/04/seam-carving-for-content-aware-image-scaling/ http://jeremykun.com/2013/03/04/seam-carving-for-content-awa... [3]: http://jeremykun.com/2014/09/29/hybrid-images/ http://jeremykun.com/2014/09/29/hybrid-images/ [4]: http://jeremykun.com/2013/12/30/the-two-dimensional-fourier-transform-and-digital-watermarking/ http://jeremykun.com/2013/12/30/the-two-dimensional-fourier-... [5]: http://en.wikipedia.org/wiki/Perlin_noise http://en.wikipedia.org/wiki/Perlin_noise [6]: http://jeremykun.com/2014/05/19/community-detection-in-graphs-a-casual-tour/ http://jeremykun.com/2014/05/19/community-detection-in-graph... [7]: http://jeremykun.com/2014/03/17/want-to-make-a-great-puzzle-game-get-inspired-by-theoretical-computer-science/ http://jeremykun.com/2014/03/17/want-to-make-a-great-puzzle-... [8]: http://jeremykun.wordpress.com/2012/02/03/cryptanalysis-with-n-grams/ http://jeremykun.wordpress.com/2012/02/03/cryptanalysis-with... [9]: http://jeremykun.com/2011/07/20/serial-killers/ http://jeremykun.com/2011/07/20/serial-killers/ [10]: http://jeremykun.com/2014/06/23/the-mathematics-of-secret-sharing/ http://jeremykun.com/2014/06/23/the-mathematics-of-secret-sh... [11]: http://jeremykun.com/2014/06/02/linear-programming-and-the-most-affordable-healthy-diet-part-1/ http://jeremykun.com/2014/06/02/linear-programming-and-the-m... [12]: http://jeremykun.com/2014/04/02/stable-marriages-and-designing-markets/ http://jeremykun.com/2014/04/02/stable-marriages-and-designi... [13]: http://jeremykun.wordpress.com/2012/12/08/groups-a-primer/ http://jeremykun.wordpress.com/2012/12/08/groups-a-primer/ [14]: http://jeremykun.com/2011/07/14/graph-coloring-or-proof-by-crayon/ http://jeremykun.com/2011/07/14/graph-coloring-or-proof-by-c... [15]: http://jeremykun.com/2012/05/27/the-fourier-transform-a-primer/ http://jeremykun.com/2012/05/27/the-fourier-transform-a-prim... [16]: http://www.ams.org/notices/201101/rtx110100036p.pdf http://www.ams.org/notices/201101/rtx110100036p.pdf
- antoyo 11y agoFunctors and monads!
- drostie 11y agoYou've got a lot of different answers, here, so I want to raise a question in your head instead: what, exactly, are you categorizing as math? I have been an academic, an engineer, and a backend-and-frontend web developer. As an academic, many of the professional mathematicians that I know cannot count a tip. One of the better definitions that I know of what they do is "creating art out of abstract patterns themselves." But computers are defined in terms of their manipulation of abstract symbols, so any programming is in this sense some form of mathematics. More on that in a little bit. So the question is, what do you mean by "math" here? Do you mean calculation? Then you need to understand how exponents work, the ballpark figure that 2^10 is about 10^3, that there are roughly 10^5 seconds in a day, roughly 10^-1 seconds in your reaction time, and roughly 10^9 things that your computer can do per second. So continuous things need to happen in less than 100 million operations, and, say, an O(n^2) algorithm will top out at sizes where n is around 10,000. That's the sort of arithmetic that you'll want to keep in your head, the mathematics of exponents. The computer will handle explicit calculations for you, but rules of thumb are unbeatable. Maybe you mean the more "engineering math" topics. Some pieces of combinatorics may help you -- at minimum, knowing that if N people at a party shake hands, there are N * (N - 1) / 2 handshakes, which is also the number of cells above the diagonal in an NxN matrix and the sum of the integers from 1 to N - 1. (All of this should make sense if you stare at it long enough.) This simple principle underlies the "birthday paradox" math, that if you start randomly selecting values out of N, you'll start to see random collisions (selecting the same value) when k^2 / 2 is approximately N, or k = sqrt(2N). So, for example, you know that if you have a playlist with 50 songs on it, the gap between repeated songs is usually about 30 minutes (sqrt(2 * 50) * 3 minutes / song), and you'll need a smarter shuffle if you want it to be closer to the (3 minutes) * 50 = 150 minutes that some users may be expecting. You should ideally also pick up factorials (and maybe Stirling's approximation of them), choose-functions, and the trick of randomly partitioning B balls into G groups by looking at binary strings pretending that 0's are balls and 1's are group partitions, hence the strings are of length B + G - 1 and the number of strings is the same as choosing B out of B + G - 1. Those sorts of patterns come up in a lot of different programming contexts, especially because a good hacker can often live by the axiom, "try brute force first" -- knowing these rules will help you know how bad your programs are with respect to scaling. A lot of engineering trickery is obscenely useful when you're writing computer programs, too: for example, engineers learn that when they know the form of something but not the exact expression, they should make sure that the "edge case" lines up. The simplest example is when you're counting up on a 0-indexed array, what's the last element you read? If you've not memorized it, just say, "oh, if the array had one element, the last index I'd read is index 0, so the exact form must be `n - 1`." If you're programming a rotation, you might say, "Oh, this thing needs to be something like r * [± cos t, ± sin t] ... but which one is the cosine, which is the sine, are any of them plus or minus?" you can answer this question pretty quickly if you know what the answer is for t = 0, where sin t = 0 and cos t = 1. Somewhere at the border between engineering math and true math is linear algebra. You do not need linear algebra in all circumstances, but it can enrich many circumstances and is required for a lot of them. If you're doing graphics, physics, simulations, probability/statistics, solving simple equations, or trying to solve linear relations, the techniques learned in a first-year linear algebra course will be invaluable and some of the vocabulary will stick with you. The fundamental ideas of calculus -- like "let's tweak the inputs a little and see how the outputs change, maybe it's roughly linear", or "why don't I store this as a list of differences between adjacent elements?" can be quite helpful, and in fact the "derivative" operation has a powerful analogue in functional programming (a data structure's "zipper" turns out to be its derivative), and occasionally you actually need to optimize things, but this is less applicable than other branches of mathematics. Is what you mean by "math" more abstract than calculus? At that even more abstract level we get some serious goodies. It turns out that there is a deep connection between mathematical models of the integers and useful data structures, if you can figure that out. Various algebras can be super-helpful, for example the patch-commutation algebra in the Darcs version control system, and the relational algebra underlying SQL. Learning a bit of lambda calculus can help you understand things on a whole new level. Finally, some basic thinking about propositional logic can really help to elevate your knowledge above simple boolean expressions, so that you can start to think of "foralls" and "there-exists" symbols, especially when you start to talk about type theories or logic programing. More important than all of that, in my experience, is really knowing your languages from the ground up. You don't need to be any of these to be a copy-paste programmer: copy a file which does something like what you want, tweak some parameters which look interesting, constantly monitoring the output of the program until it passes the tests that you want to accomplish. That's going to be the most common job out there. But if you know your language's operators and reserved words and syntactic forms in-and-out, you can do something far better -- abstraction -- which will make your code far more useful in the end. But the thing is, if mathematics is making art out of patterns themselves, then programming language design is also, somewhere, a field of mathematics: and learning this is a sort of "math", too. There is a "math" of parsing. You can even find libraries of "parser combinators" -- you might want to watch some talks explaining how those work. Similarly, there is a "math" to really understanding pointers and graph traversals and such. I've seen people who have your "10 years of experience" and have never seen any of those things and don't really understand, for example, JavaScript's scope rules. They write fairly good code, but it can often be much, much smaller -- and faster and easier to maintain. So to me, that's the key first step. Understand a couple different languages from the ground-up, and how they approach the world.
- 4ydx 11y agoIf you don't understand set theory, you cannot possibly be a programmer. That is to say, whether or not you realize you are applying set theory, it is the heart of programming.
- AnimalMuppet 11y agoSet theory is the heart of programming? I call BS. Can you provide a foundation for that statement? And no, I'm not coming from "category theory is the heart of programming", either.
- pscheyer1 11y agoTl:dr- In order; graph theory, linear algebra, number theory, and multi-criteria decision analysis. Game theory, set theory, nonlinearity, computational geometry a bonus. Let's say you're learning some new algorithms. Your list might look something like the below list[1]. I'll add in brackets the sort of math you learn about by learning the algo if you get lost down the wiki-rabbit-hole. If you want to solve other similar problems, more of that sort of math will help. 1) Graph algorithms [graph theory]: Breadth first search(BFS), Depth first search(DFS), Strongly connected components(SCC), Dijkstra, Floyd-Warshall, Minimum spanning tree(MST), Topological sort. 2) Dynamic programming [self-similarity, finite subdivision rules, nonlinear equations]: Standard dynamic programming problems such as Rod Cutting, Knapsack, Matrix chain multiplication etc. 3) Number theory [Number Theory]: Modular arithmetic, Fermat’s theorem, Chinese remainder theorem(CRT), Euclidian method for GCD, Logarithmic Exponentiation, Sieve of Eratosthenes, Euler’s totient function. 3) Greedy [goal programming, simplex algorithm, multi-criteria decision analysis]: Standard problems such as Activity selection. 4) Search techniques [linear/vector algebra[2]]: Binary search, Ternary search and Meet in the middle. 5) Data structures (Basic) [graph theory]: Stacks, Queues, Trees and Heaps. 6) Data structures (Advanced)[more graph theory]: Trie, Segment trees, Fenwick tree or Binary indexed tree(BIT), Disjoint data structures. 7) Strings [set theory]: Knuth Morris Pratt(KMP), Z algorithm, Suffix arrays/Suffix trees. These are bit advanced algorithms. 8) Computational geometry [computational geometry]: Graham-Scan for convex hull, Line sweep. 9) Game theory [game theory]: Basic principles of Nim game, Grundy numbers, Sprague-Grundy theorem. [1] http://blog.hackerearth.com/2013/09/competitive-programming-getting-started_11.html http://blog.hackerearth.com/2013/09/competitive-programming-... [2] Scott Aaronson noted that the vector algebraic Eigenvector operation was the linchpin of google's pagerank, when applied to the adjacency matrix of the directed graph that is the world-wide web. So i assume that knowing some vector algebra might be useful for search. http://www.scottaaronson.com/blog/?p=1820 http://www.scottaaronson.com/blog/?p=1820