9 ms·
Why there is no Hitchhiker’s Guide to Mathematics for Programmers
- darkxanthos 13y agoI like how the author mentions having an executable mathematical language might be helpful. Math is a non-standard non-machine-executable programming language which means it's inherently buggy. On top of that, now I need to interpret the "code" while I'm learning and it can be pretty dense. Much like in programming, I'm sure expert mathematicians may not see why it's so painful, but wait until a more robust language/system is developed for the hobbyist. It will be extremely disruptive.
- TelmoMenezes 13y ago> Math is a non-standard non-machine-executable programming language which means it's inherently buggy. I don't understand what you mean by non-standard. I can't think of any language more standard than mathematics. Mathematical theorems are formally proven. That is a higher form of knowledge than empirical validation (running programs against tests). Another case of empirical validation is scientific experimentation. It validates theories by increasing our assessment of their plausibility, but never up to 100%. Mathematical proofs are the only completely objective form of knowledge. Automatic theorem provers do exist and are employed by mathematicians, but they are inherently limited, as proven by Gödel's undecidability theorems.
- Dylan16807 13y ago>I don't understand what you mean by non-standard. Symbols in advanced math tend to be very poorly defined and contextual. Imagine programming if every function had a two-letter name and the list of which packages to import was left out half the time. This is covered in the article. Proofs formatted for automatic solvers show that they can be standardized. Now think about the tiny percentage of proofs that are in this form.
- magicalist 13y ago> Proofs formatted for automatic solvers show that they can be standardized. Now think about the tiny percentage of proofs that are in this form. Just as important, though, is the number of proofs that anyone would want to read in that form. I can't think of anyone who has ever claimed that reading formally verified proofs aids understanding...
- Dylan16807 13y agoRight, the current methods are probably awful for reading. It's a proof of concept more than anything, when it comes to using standard terminology.
- yummyfajitas 13y agoMathematical theorems are formally proven. It's formal compared to colloquial english, but completely vague compared to computer programs. There are automatic theorem provers, but it isn't Godel's undecidability theorem that limits them. It's the difficulty of formally writing down our proofs in machine readable format that limits them for practical purposes.
- karamazov 13y agoMathematical proofs are completely precise, that is to say, not vague in the least. They are, however, in an extremely high-level language; it's left to the reader to expand the notation enough to convince themselves of the validity. (And, of course, there can be bugs - that is, mistakes - but there is no ambiguity.)
- cwp 13y agoSo the underlying ideas are precise, but they're expressed in imprecise language? That's true of all communication. When I ask my wife for "that thing by the door," I know exactly what I mean, but she has a to do a lot of work to decode it.
- dbaupp 13y ago> Automatic theorem provers do exist and are employed by mathematicians, but they are inherently limited, as proven by Gödel's undecidability theorems Human mathematicians are equally limited by Gödel.
- asolove 13y agoWhat? Due to the Curry-Howard Correspondence, mathematical proofs are in fact very precisely executable: http://en.wikipedia.org/wiki/Curry%E2%80%93Howard_correspondence http://en.wikipedia.org/wiki/Curry%E2%80%93Howard_correspond... There may be lots of room to improve the "UI" of math [0] but I don't see how you could desire more power or verifiability than what modern mathematical proof systems offer. [0] http://worrydream.com/KillMath/ http://worrydream.com/KillMath/
- stygianguest 13y agoOnly proofs in 'constructive' logic. There's a lot of proofs that aren't executable. Most importantly proofs by contradiction. See: http://en.wikipedia.org/wiki/Intuitionistic_logic http://en.wikipedia.org/wiki/Intuitionistic_logic In practical terms, however, this isn't a huge hurdle and comes with the nice advantage that you always have a program. BTW. I'm kinda sure you know this already, but I think it is important to mention. Thanks for the Haskell proof-book link. I'll check it out sometime.
- magicalist 13y agoHmm, I don't understand the problem. There is a philosophical question there, of course, but as long as you assume something like the law of excluded middle, you can easily set up a proof system allowing you to execute proofs by contradiction. This is a common strategy in Coq, for instance. Maybe I'm not understanding your point, though. I also don't think this chain of conversation is the sense that darkxanthos meant, either :)
- thetwiceler 13y agoThe idea is that the Curry-Howard isomorphism allows you to "play" with constructive mathematics easily. For example, consider the fact that the composition of two functions f and g is continuous if each function is continuous. Suppose f : X -> Y and g : Y -> Z. Then, in pseudo-Haskell syntax, we could say continuousf : Open set in Y -> Open set in X continuousg : Open set in Z -> Open set in Y continuousgf : Open set in Z -> Open set in X continuousgf = continuousf . continuousg The idea is that the fact that f is continuous means that we can produce open sets in X given open sets in Y. Now, consider the fundamental theorem of algebra over complex numbers. This says that any polynomial with complex coefficients with degree greater than 0 has at least one complex root. We'd like to have a function fta : Polynomial P of degree >0 over C -> (Point x in C, proof that P(x)=0) which would compute this root. But the thing is, the standard proof (e.g., by Louiville's Theorem) of the FTA is not constructive. The proof is by contradiction: Suppose there were no root. Then we violate some principle of complex analysis that we know is true (Louiville's Thm, or Maximum Modulus Principle, for example). Thus there must be a root. But this doesn't tell us at all how to compute the root! So instead we need a constructive proof of the FTA in order to produce a root. So, the idea is that you can't "play" with non-constructive mathematics in programming as you can with constructive mathematics. Our standard FTA proof would look like fta : Polynomial P of degree >0 over C -> Exists x. P(x)=0. But the type of the object that this function produces isn't very fun to play with. We have no idea what the root is!
- rfnslyr 13y agoI was hit hard in the face by a segmentation fault. It took hundreds of test cases and more than twenty hours of confusion before I found the error: I was passing a reference when I should have been passing a pointer. That code wouldn't compile, if a pointer is expected you can't just pass a reference, hello static typing. Furthermore, you can't explicitly "pass a reference" to begin with, as in there is no syntax in the caller to signify "this shall be passed as a reference", that would be something that is in the signature of the CALLEE. So his "error" literally makes no sense as it cannot happen. If what he means is that he wrote the callee wrong, that doesn't make any sense either, because the whole point is that you can't reseat (make to point to something else) a reference. So you would know if you needed to use a pointer instead the minute you tried to reseat a ref type. Also, anyone who takes 24 hours to debug a segfault needs to pick another profession and quickly.
- wetmore 13y agoThis is probably one of the least-important parts of the article. It was a generic example of a situation where you spend a long time trying to solve an error based on something relatively trivial. There is no reason to call him out on this portion of the post as it doesn't pertain to the point of the article, and just makes you look sort of dickish.
- humbledrone 13y agoIf you have never taken 24 hours to debug a segfault, you haven't done enough C/C++ programming. E.g. a rare race condition causes some memory to be freed while there's still a live pointer to it, but THAT doesn't cause a segfault immediately because the memory is immediately reused for some other data structure (in a different thread), so when the dangling pointer is accessed it points to allocated memory that's being used for some other purpose. Some field in the data structure the dangling pointer references is mutated, and then finally in another thread that same memory is accessed via a different pointer (the one that was recently allocated) and part of it is treated as a pointer, and dereferencing THAT causes a segfault. (Oh and by the way, in real life things can get much more complicated than this before the program blows up with a segfault. In fact, you're lucky if there's a segfault, instead of finding out months down the road that your data has been subtly wrong the whole time.) Ultimately the solution to this is some iterative combination of swapping in a guarded malloc, then trying things in Valgrind, then trying various Valgrind options, then setting some hardware watchpoints in gdb, then finding that the race condition disappears in the debugger, then adding log statements all over the place, then statically analyzing the code for hours while pulling your hair out, then finally by accident noticing that padding the first data structure with an extra field makes the problem go away, then setting the right hardware watchpoint that actually helps, etc, etc, then piecing together a real story for what's happening, and ultimately making a 2-line fix. If you think you're somehow "above" this kind of horrible drudgery, and that your immense programming skill will let you avoid it forever, then you are just not very experienced (or you're not working on hard problems).
- skylan_q 13y agoExcellent read. Thanks for this.
- asolove 13y agoWhile there is no "royal road" to mathematics for programmers who don't care about proofs, there is a programmer's road to proofs for those interested in Math. In fact, the book is even called "The Haskell Road to Logic, Maths and Programming" [0]. It covers mathematical notation, proof construction, and lots of interesting portions of discrete math that should be of interest to programmers. And large portions of the results are demonstrated or used in interesting Haskell programs. [0] http://www.amazon.com/Haskell-Programming-Second-Edition-Computing/dp/0954300696/ref=cm_cr_pr_product_top http://www.amazon.com/Haskell-Programming-Second-Edition-Com...
- dysoco 13y agoThat book is on my to-read list, yet I don't know what to think of a book that starts like this: http://i.imgur.com/rSc0fpw.png http://i.imgur.com/rSc0fpw.png
- ef4 13y agoThe validity of that statement depends on your historical perspective. To the modern eye, we see radically different type systems and conclude they are as different as night and day. But there was a time when the world was divided into people who thought anything higher-level than C or FORTRAN was stupid and impractical, and those who aspired to build more abstract languages. LISP was one of the rallying cries of the latter group. Haskell clearly falls into that group too.
- dysoco 13y agoHm, that makes some sense, the book might be old, that's why.
- andrewflnr 13y agoIt can't be that old, since according to Wikipedia Haskell itself is only about 23 years old. http://en.wikipedia.org/wiki/Haskell_(programming_language) http://en.wikipedia.org/wiki/Haskell_(programming_language)
- polarix 13y agoThe syntax blocker is the biggest one for me. Are there books full of classic proofs and explanations of their syntax and shorthand? I'd be very interested.
- claudius 13y agoUsually, each maths textbook defines the syntax used within at the start and then ‘rewrites’ all proofs in that particular syntax. Since syntax – as opposed to the mathematical facts expressed thereby – is usually considered something not worth learning by heart, I doubt that you will find a book that collects proofs in their syntax of original publication and then explains that syntax.
- ivan_ah 13y agoI wrote a little "math syntax" to "english words" dictionary which might help you: http://mcgillweb.alwaysdata.net/notation_appendix.pdf http://mcgillweb.alwaysdata.net/notation_appendix.pdf In particular the section on set theory is important (element of, subset, etc..) and the two qualifiers: for all, and there exists. Here is a 6 page primer on set notation, which contains a simple proof http://mcgillweb.alwaysdata.net/set_notation.pdf http://mcgillweb.alwaysdata.net/set_notation.pdf
- tel 13y agoYes! Grab a copy of "Proofs from the Book". It's tremendous.
- dagw 13y agoProofs from the Book is awesome. Another book in a similar vein, but requiring less of a mathematical background and targeted more at the curious layman is "Journey through Genius". Journey through Genius also spends more time giving general background about the players involved and telling the story leading up to the proof.
- dysoco 13y agoSo could anyone suggest a nice book for a High School student (I know basic algebra, but no Calculus so far) to learn math? The school system is not very good here, so I have to do some of the learning by myself. I have looked at Concrete Mathematics by Donald Knuth, would that be complicated to understand?
- EllaMentry 13y agoConcrete Mathematics should not be too hard to understand for someone who understands basic algebra. Most of the topics it covers use nothing more than arithmetic and simple logic. That said it is not a good general mathematics book (it is designed as a Computer Science book). A book that will help you - How to think like a Mathematician: http://www.amazon.ca/How-Think-Like-Mathematician-Undergraduate/dp/052171978X/ref=sr_1_1?ie=UTF8&qid=1378670300&sr=8-1&keywords=how+to+think+like+a+mathematician http://www.amazon.ca/How-Think-Like-Mathematician-Undergradu...
- j2kun 13y agoI recommend Paul Lockhart's Measurement.
- ivan_ah 13y agoCheck out my No bullshit guide to math and physics: http://minireference.com/ http://minireference.com/ [$33], it covers all of high school math, mechanics, derivatives, and integrals. An excellent free alternative is Calculus Made Easy by Silvanus P. Thompson, which is very good and also funny http://www.gutenberg.org/ebooks/33283 http://www.gutenberg.org/ebooks/33283
- dysoco 13y agoThat book looks amazing, I'd love to learn some Physics too, will see if I can get it. Read the first pages of Calculus Made Easy, looked nice so far.
- deleted 13y ago[deleted]
- 13y ago
- ivan_ah 13y ago> To learn mathematics from scratch. The working programmer simply doesn’t have time for that. I disagree. Most of high school math and calculus can be learned fairly quickly (like weeks). This is what I have been trying to do with my book "No bullshit guide to math and physics." It has been very successful with coders: http://minireference.com/ http://minireference.com/ Also on the topic math \cap code, here is an excellent talk by Gerald Sussman: http://www.infoq.com/presentations/Expression-of-Ideas http://www.infoq.com/presentations/Expression-of-Ideas
- j2kun 13y agoThe problem is that high school math and basic calculus is not much mathematics at all, and it still has the problems of foreign notation and ambiguity.
- ivan_ah 13y agoHS math and calc a is some math, definitely not all, but a good chunk of what I would call "applied math"---the math that links directly to the real-world, meaning the concepts can be understood intuitively, e.g., the connections to physics. The trick is to covertly throw in some formal proofs to prepare the reader for the more abstract stuff. Going directly into proofs might be too much of a jump for some people, though I agree that, ultimately, this is what mathematics is about. As for the foreign notation, I wrote an appendix which explains how to read things: http://mcgillweb.alwaysdata.net/notation_appendix.pdf http://mcgillweb.alwaysdata.net/notation_appendix.pdf
- wolfgke 13y ago> HS math and calc a is some math, definitely not all, but a good chunk of what I would call "applied math"---the math that links directly to the real-world, meaning the concepts can be understood intuitively, e.g., the connections to physics. IMHO there's little mathematics that can't be applied to the real world rather directly. I even heard mathematicians say that the distinction between pure and applied mathematics is mostly for historical reasons. Especially if you consider connections to physics as intuitive understandability - for example in string theory or quantum field theory you'll find lots of highly complicated mathematics.
- cliveowen 13y agoIf it weren't for mathematics I would've graduated this year, instead I'm still stuck with Algebra and Calculus and what not. I don't know about you, but every time a read a theorem is like getting kicked in the nuts and then punched in the stomach. The fact is, our brains are wired to excel at a handful of things and if math it's not one of them you're out of luck. You can't teach a person to paint, or to write, because you can't teach them talent, the same is true with math. You just have to plough through and hope to get better with time.
- justinlloyd 13y ago"You can't teach a person to paint, or to write, because you can't teach them talent, the same is true with math." Never a falser word spoken.
- cliveowen 13y agoSo you can teach talent.
- oblique63 13y agoYes: http://www.amazon.com/Talent-Code-Greatness-Born-Grown/dp/055380684X/ http://www.amazon.com/Talent-Code-Greatness-Born-Grown/dp/05... Success/fame/fortune/happiness/etc are another matter, but skill acquisition has been shown to be generally straightforward. Some things may have higher learning curves for some people (e.g. math for a person with dyscalculia[1]), but that doesn't mean it's impossible. [1] http://en.wikipedia.org/wiki/Dyscalculia http://en.wikipedia.org/wiki/Dyscalculia
- cliveowen 13y agoNow I don't wanna be that guy and I hate it to break it to you, but the author isn't a behavioral psychologist or a social scientist. He graduated from journalism school, he's in the business of writing books and his credentials for tackling such an argument are squat. Hoping that practice alone in any given subject will get you wherever you want, is just wishful thinking. Think of all the kids that play piano, or write poems or generally do something great at a very young age. You can ascribe their skills to practice or experience, given their age, you just have to acknowledge that it's talent, an innate ability. They don't learn how to play piano, they just get it. The same is true with math people, their brains are wired to comprehend a complex subject, arguably impenetrable for most of the population.
- shire 13y agoGreat read, Khan academy does solve a lot of the headaches that come with Math, thank you Salman Khan! if it wasn't for him I wouldn't have gotten a 3.8 in Calculus. for those who don't know math or want to learn this will make your life easier, https://www.khanacademy.org/ https://www.khanacademy.org/
- dominotw 13y agoI am not a big fan of 'black screen with voice over' format. There are much much better alternatives for calculus these days, for example calc1 course on coursera is excellent.
- shire 13y agoOn the contrary I prefer his method of teaching more than anything else, it can be quite distracting when there is a face or hand movements on the screen.
- Dewie 13y ago> It is an interesting pedagogical question in my mind whether there is a way to introduce proofs and the language of mature mathematics in a way that stays within a stone’s throw of computer programs. It seems like a worthwhile effort, but I can’t think of anyone who has sought to replace a classical mathematics education entirely with one based on computation. ...Curry–Howard correspondence?
- j2kun 13y agoIs quite a large stone's throw away from both computer science and standard mathematical proofs.
- slurry 13y agoWhen I picture a Hitchhiker's Guide to Mathematics, I don't picture a book that actually teaches you mathematics. I picture a book will, on demand, give you just enough information to get by in a particular area of mathematics without blowing off a leg or something. You know, like the Hitchhiker's Guide to the Galaxy didn't actually make you an expert on a planet, just gave you some tips for having fun and just barely surviving should you find yourself stuck there. So yeah, a big book of formulas, algorithms and mathematical structures with example applications complete with code snippets and exhaustive indexing. You wouldn't learn anything worthwhile (not Real Math and not really even applied mathematics) but it might get you out of a jam now and then. It would take heroic effort and probably sell in the hundreds at best, it would be an immense challenge to keep the examples general enough while still being useful, but there's no a priori reason why it couldn't be done.
- lutusp 13y agoThis is a terrific idea -- a math book that avoids the pitfalls of most math books aimed at nonmathematicians. Such a book could cover many important mathematical ideas without necessarily lapsing into equations and overly technical explanations. For example, it should be possible to describe how compound interest works without falling into an obscure technical explanation, and understanding compound interest is very important in modern life. Another example might explain why the stopping distance of s car is proportional to the square of the speed -- this is not well-known, and it's important for drivers to know, young ones especially. Yet another example would explain why each member of the running sum of odd numbers is a perfect square. Expressed in words, it's not obvious that it's true or why it's true, but a picture conveys the reason immediately and intuitively: http://arachnoid.com/example/index.html#Math_Example http://arachnoid.com/example/index.html#Math_Example Just a few examples. I'm sure one could fill such a book with useful examples that would convey useful information, and make math sound like fun, or both, without being preachy or too technical.
- wolfgke 13y ago> For example, it should be possible to describe how compound interest works without falling into an obscure technical explanation I personally find these obscure technical (and highly abstract) explanations often far more easy to understand. I often found "easy" explanations highly illogical - not before I got the rather abstract explanations I found these explanations acceptable (and even this was not always the case - almost always the explanation for this phenomenon was that the definitions given in foundation courses could be abstracted a lot). How can this be explained? The reason is simple: in highly abstract definitions anything that is not necessary is omitted - so there is less to think about. Additionally in this kind of definitions there is a lot more "internal logic". What does this mean? This is a little bit difficult to explain for non-mathematicians, but you can be sure that anything in the definition has a deep meaning. If this meaning seems strange to you, you can be sure that what remains to be understood often carries a deep meaning. On the other hand: when using "simple" definitions, you always have to worry whether, if something sounds strange, it is because you haven't understood it or if the "simple" explanation was simply bad. Disclaimer: I'm a mathematician (as may be imagined). But I'm a computer scientist, too. :-)
- mtdewcmu 13y ago> My programs absolutely reeked of programming no-nos. Hundred-line functions and even thousand-line classes, magic numbers, unreachable blocks of code, ridiculous code comments, a complete disregard for sensible object orientation, negligence of nearly all logic, and type-coercion that would make your skin crawl. It probably would have been easier to start on a language that's procedural and maybe dynamically-typed. There are fewer traps to fall into.
- beloch 13y agoWhen you tackle a new problem the hardest part is often just figuring out what you don't know, but need in order to solve the problem. You might find a paper or book that solves a very similar problem (if you're lucky) but find you just can't understand what you're reading. This is probably because the author assumed his audience would know things you've never even been exposed to. It would be rather hard to write much of anything if authors didn't do this! However, it makes life rather difficult for "foreigners" to the discipline who don't have a good idea of the discipline's city layout and what neighborhoods they need to hang out in to find help. The ideal solution is to get a local guide to help you, but a map of knowledge covering as much of the city as possible would be almost as helpful if it were any good. Unfortunately, mapping cities of knowledge is harder than mapping real cities! It would be utterly fantastic if math (or physics, economics, etc.) books and publications came with associated meta-data that would tell you what dependencies are associated with what you're reading. Ideally, it should be possible to trace the map from string theory right back to counting. This map would be your guide to all the rabbit holes you dive into! It wouldn't perform magic and explain quantum physics to you in a paragraph, but it would give you an idea of how much you don't know and where you need to start.
- kephra 13y agoI have to disagree to the basic assumption of the article. Its often not necessary for a coder to understand why math works, but only how to use their results. e.g.: I've coded fft in 5 different languages, and used it uncountable times. Still it took ages to understand why dft works, and I did not yet took the step to understand how dft leads to fft. I know dozens of Second Life scripters (including me) who use quarternions regular, still nobody could tell me, why they work so good for 3d rotations. I've coded my first Markov, 35 years ago, at the age of 12, and Markov was never mentioned in school at all. I'm using dozens of machine learning methods on daily base, coded a few my self, but I do not care to know why they work, but only what their strong points and limitations are. Its not necessary to know how to design and build a car, if you just need to drive from A to B. Its not necessary to study bio-chemistry, to be a good cook.
- j2kun 13y agoThe article does not argue that anyone needs to do mathematics. It just attempts to explain why mathematics tends to be hard for otherwise smart and motivated programmers. That being said, fft is a divide and conquer approach to multiplying the dft matrix by a vector, and it achieves nlogn time by taking advantage of the special structure of the dft matrix.
- contingencies 13y agoThis seems like a resonable place to mention that years ago a guy called Tom Henderson in Portland put up a kickstarter project for a Punk Mathematics book, which I funded, but he has taken $30,000, completely disrespected his funders and failed to produce anything at all. If you meet the guy, do (verbally) thump him for me. http://www.kickstarter.com/projects/1541803748/punk-mathematics http://www.kickstarter.com/projects/1541803748/punk-mathemat...