4 ms·
Previous submissions: https://news.ycombinator.com/item?id=4796586 https://news.ycombinator.com/item?id=4796586 https://news.ycombinator.com/item?id=4915328 h
by pmiller2 13y ago
Previous submissions:
https://news.ycombinator.com/item?id=4796586 https://news.ycombinator.com/item?id=4796586
https://news.ycombinator.com/item?id=4915328 https://news.ycombinator.com/item?id=4915328
Also:
Refuting “The Mathematical Hacker”: https://news.ycombinator.com/item?id=4921953 https://news.ycombinator.com/item?id=4921953
- ColinWright 13y agoFantastic - thank you. Interesting discussions, and I hope people take the time to read the article, threads, refutation, and other comments. I look forward to any additional comments and contributions people may choose to make here.
- new_test 13y agoLooks like you re-posted your own old submission. Nothing wrong with it I guess since people are still interested judging from upvotes. But that would be one of the reasons "the quality of HN threads is going down" as many complain. Some older users don't even want to comment anymore, since it's all the same thing re-posted all over again. Well that and bitcoin/NSA "news".
- scott_s 13y agoThreads like this are not the problem.
- scott_s 13y agoColin, I'm curious about your take on the essay. I have to admit that while I did read it, I did not engage with it deeply because I felt that the author created strawman views, particularly with regards to the people mentioned and the "Lisp school of programming." Since I found the premises so confused, I didn't have the energy to disentangle the real point from them. (Part of my curiosity on your take comes from the fact that you commented on a similarly themed essay I wrote some time back.)
- ColinWright 13y agoI've put it on my list of things to write about. It's a long list, but I hope to knock a few things off it over the holiday. Thanks for asking - I'll post here if/when I get something done.
- electronvolt 13y agoSomething that was posted on HN once or twice before was EWD 1036: "On the cruelty of really teaching computer science", by Dijkstra. It makes, in my opinion, a much more lucid argument than this article as to why a firm background in math, particularly theoretical math, is important for programmers of all sorts. It's definitely something I'd read if you're thinking about the role of math in computer science and programming as fields. The article is here: http://www.cs.utexas.edu/users/EWD/transcriptions/EWD10xx/EWD1036.html http://www.cs.utexas.edu/users/EWD/transcriptions/EWD10xx/EW... There have been numerous submissions of it to HN, of varying popularity. The ones I could find with the most comments are: http://news.ycombinator.com/item?id=6838434 http://news.ycombinator.com/item?id=6838434 (three weeks ago) http://news.ycombinator.com/item?id=3553983 http://news.ycombinator.com/item?id=3553983 (one year ago) http://news.ycombinator.com/item?id=1666445 http://news.ycombinator.com/item?id=1666445 (three years ago)
- gus_massa 13y agoI don’t like the gamma example. In the second (4915328) previous submission, there is a comment of kenko: https://news.ycombinator.com/item?id=4918977 https://news.ycombinator.com/item?id=4918977 . Minimal extract: > >>> int(math.exp(math.lgamma(41))) > 815915283247882431423526575245034982027017846784L > [...] > Prelude> fac 40 > 815915283247897734345611269596115894272000000000 Another problem is that lgamma runs in constant time but it’s accurate only in a finite range. To extend the range the polynomial must have more terms, so the “accurate” version doesn’t run in constant time. And for enough precision, you must use the “long” version of the floating point numbers. The complete analysis is complex and I don’t have enough time to do it. The recursive functions runs in linear time only for small numbers. It uses only integer arithmetic that is faster. But if the number are big enough you must use “long” integers, and the time is probably quadratic. So it’s not clear which version is better, neither for small numbers nor for big numbers and asymptotic behavior.
- barrkel 13y agoWhen I need a decently performing factorial, I generally break out a memoized iterative version.
- mturmon 13y ago"So it’s not clear which version is better..." In general, it's application-dependent. But often, in applications, the factorial enters multiplicatively, and they are in products with other stuff; the whole thing can easily underflow or overflow. So what you often really want is the log of the factorial. (If someone gave you the exact integer factorial for free, the first thing you'd do is take its log.) That's why they implemented lgamma(). The error guarantees it gives are in the log domain, which is (often, not always) what you want, anyway.
- sbi 13y agoTypically you wouldn't use lgamma to compute exact values of factorials at all. For a real world example of this function in action, look at John D. Cook's blog: [1]: http://www.johndcook.com/blog/2012/07/14/log-gamma-differences/ http://www.johndcook.com/blog/2012/07/14/log-gamma-differenc... [2]: http://www.johndcook.com/blog/2010/08/16/how-to-compute-log-factorial/ http://www.johndcook.com/blog/2010/08/16/how-to-compute-log-... [3]: http://www.johndcook.com/blog/2008/04/24/how-to-calculate-binomial-probabilities/ http://www.johndcook.com/blog/2008/04/24/how-to-calculate-bi...