HackerURLs

一次又一次被重新发现的经典。

同一个链接,相隔一年以上,一次又一次被人重新发现、再次冲上 Hacker News 首页。能经受住这种时间检验的,大多是值得一读再读的文章。每篇附中文标题,讨论最热的那些再加上中文导读和高赞评论翻译。

从名人堂开始
  • 4,700+篇经过时间检验的经典

Hall of fame

名人堂

在经典库里看全部精选

上首页次数最多、而且有中文导读的 30 篇。时间轴上每个黑点是一次上首页,空心点是一次没冲上去的投稿。

  1. 正在载入经典…

Archive

经典库

按第一次上首页的年份分布,点柱子筛选。

排序

    About

    这些经典是怎么挑出来的

    1. 01

      合并同一个链接

      读取 Hacker News 自 2006 年以来的全部链接投稿,把 http/https、www、跟踪参数等写法不同的同一篇文章合并成一条。

    2. 02

      只留经得起时间的

      同一链接至少两次拿到 50 分以上(约等于上首页),而且两次相隔一年以上;再由 AI 剔除状态页、产品首页和新闻事件。

    3. 03

      写导读、译评论

      上首页次数最多的 2,000 篇配上中文导读、"为什么经久不衰",并精选翻译 HN 高赞评论。导读由 AI 生成,可能有误。

    科学与数学johndcook.com

    不要直接求矩阵的逆

    Don’t invert that matrix (2010)

    3次上首页
    6年跨度
    291累计得分
    88条评论

    2010 — 2016,它一次次回到首页

    黑点是上首页(≥ 50 分)的那次投稿,空心点是没冲上去的投稿,点越大分数越高。

    导读

    这篇文章讲的是数值计算中的一个常见建议:解线性方程组 Ax=b 时,不要显式求出 A 的逆再相乘,而应使用矩阵分解或库里的专用求解器。文章解释了为什么求逆通常更慢、更不稳定,以及在需要处理多个右端项 b 时应复用分解而不是反复求逆。

    为什么经久不衰:它用简短有力的方式点出了一个广泛存在的数值计算误区,多年后仍是科学计算和数据分析中的实用提醒。

    关键词 数值线性代数矩阵求逆线性方程组科学计算

    HN 评论精选

    纠正文章一个理由:求逆求解未必更不准,只是通常更慢。

    这篇文章的核心建议是对的:如果针对手头问题存在更直接的方法,就尽量避免求矩阵逆。不过它给出的一个理由不正确:Druinsky 和 Toledo 已经证明,尽管很多人相信相反说法,通过先算逆再解线性系统,其精度可以和直接求解一样好(只是效率差得多)。他们还推测这个迷思为何流传已久:用逆矩阵计算解时有一个容易推导的误差界,看起来预测误差很大,但过于保守;存在更好的界,能保证误差与直接法同类,只是更难推导。

    IngoBlechschmid查看英文原文

    That article is quite right regarding the take-home message to try to avoid inverting a matrix when other, more direct methods for solving the particular problem at hand exist. On page 2 of http://www.ti3.tuhh.de/paper/rump/Ru08a.pdf there is an innocent-looking matrix for which the numerically computed inverse is off from the true inverse by 47 orders of magnitude. However, one of the reasons he's given is not correct: Druinsky and Toledo have shown (http://arxiv.org/abs/1201.6035) that -- despite the very widespread belief to the contrary -- solving a linear system be calculating the inverse can be as accurate (though not nearly as efficient) as solving it directly. They even speculate as to how this myth was able to sustain it for so long. Namely, there is a certain error bound for the solution as calculated by employing the inverse which is quite simple to deduce and which predicts a pretty large error. However, this bound is too conservative. There is a better bound, which ensures that the error is of the same kind as for the direct method. However, this bound is much harder to derive.

    实测求逆慢且精度略差,但计时受预热影响,差距会缩小。

    一个 Matlab/Octave 例子显示 inv 更慢且精度略差。编辑:这其实是计时警告。inv 函数还没“热身”。第二次运行时两者时间都下降,差距也小很多。

    imurray查看英文原文

    A Matlab/Octave example of inv being slower and less accurate: >> A = randn(100); x = randn(100,1); b = A*x; >> tic; x1 = inv(A)*b; toc Elapsed time is 0.142381 seconds. >> tic; x2 = A\b; toc Elapsed time is 0.000736 seconds. >> max(abs(x-x1)) ans = 7.1054e-14 >> max(abs(x-x2)) ans = 4.8406e-14 Edit: Actually this is a warning about timing stuff. The inv function hadn't "warmed up". On a second run both times drop, and the difference is much smaller: >> tic; x1 = inv(A)*b; toc Elapsed time is 0.000737 seconds. >> tic; x2 = A\b; toc Elapsed time is 0.000471 seconds.

    R 的 solve 函数鼓励直接求解,inv(A)%*%B 是坏味道。

    在 R 里有一个语法上的小提示:矩阵求逆函数其实叫 solve。solve(A,B) 给出 AX=B 的解,而 B 默认是单位矩阵,所以 solve(A) 只给出逆;代码里任何 solve(A) %*% B 都应该被看成警示信号。正如 rcxdude 提到的,这在统计应用中更值得注意,而 R 正是为此而生。

    andy_wrote查看英文原文

    In R there is a little syntactical nudge in this direction in that the matrix inversion function is actually called `solve`. `solve(A, B)` gives you the solution to AX = B, and B's default argument is the identity, so `solve(A)` just gives you the inverse, and any instances of `solve(A) %*% B` in your code should stand out as red flags. As rcxdude mentions this is something that you tend to care more about in statistical applications, and that's what R is for.

    应优先使用成熟库和专用求解器,而不是自己实现数学算法。

    另一条适用范围远超矩阵求逆的建议:只要能避免,就不要自己用代码解数学问题。用成熟库,并选用最具体的方法:如果有专门解 Ax=b 的例程,就用它,不要用矩阵求逆方法,甚至不要用 LU 分解例程,哪怕“真正的数学”告诉你结果等价——在数值计算中,数学等价和纯数学家关心的不是一回事。

    ewjordan查看英文原文

    Here's another piece of advice that covers a lot more than matrix inversion: don't solve math problems yourself in code if you can in any way avoid it. Use a library instead, and use the most specific methods that are available: if there are specialized routines to solve Ax=b, use them, don't use the matrix inversion methods (which are probably also there), or even the LU decomposition ones, even if Real Math tells you that the result is equivalent - in numerical computation, mathematical equivalence is an entirely different entity than what "real" mathematicians concern themselves with. Seriously. I don't care if you're a math PhD, I don't even care if you know a decent amount about numerical methods. Whatever code you're going to put together to do the job will be inferior to what a mature library can do, simply because the library has been put through many iterations and has had a lot more time to get patched up to handle all those special cases (usually related to finite precision or discretization) that Real Math doesn't have to worry about. And it will probably be vastly more optimized than anything you'll put together, because it's spent years of heavy use in some critical research environments. The only time you should be writing your own math code (beyond simple arithmetic) is if no mature libraries are available to you. In which case you should allocate at the very least twice the amount of time it will take to research and implement the methods, and probably a lot more, because you're going to have a lot of fiddling to do.

    历次讨论

    同类还值得读

    1. 如果月球只有 1 像素:一个极其精确的太阳系模型(2014)

      If the moon were only 1 pixel: A tediously accurate solar system model (2014)

      一个网页版太阳系模型,以“如果月亮只有 1 像素”的真实比例呈现:你必须一路横向滚动,才能体会行星之间空旷到何等程度。

      科学与数学上首页 7 次 · 2014–2025joshworth.com编辑精选
    2. 沉浸式线性代数(2016)

      Immersive Linear Algebra (2016)

      《Immersive Linear Algebra》是一本完全免费、开放在线的线性代数“超文本教科书”,其最大特色是大量可交互的图形:读者可以直接拖动、操作图中的向量、矩阵和变换…

      科学与数学上首页 5 次 · 2015–2024immersivemath.com编辑精选
    3. 如何将贝果切成两个相连的半环(2009)

      How to Slice a Bagel into Two Linked Halves (2009)

      数学家 George Hart 的经典教程,演示如何用一刀把贝果切成两个相互扣住的环,并附上切割步骤与数学原理。

      科学与数学上首页 5 次 · 2009–2022georgehart.com
    4. “犹太问题”:一组用于歧视的数学题

      Jewish problems

      一篇 arXiv 论文,整理并讨论苏联时期犹太学生在申请大学数学系时被问到的特殊数学难题:这些题往往有简单解法却极难想到,被用作面试中拒绝犹太考生的手段。

      科学与数学上首页 5 次 · 2011–2021arxiv.org
    5. 你的身体并非为长久而造:人类死亡率数据的一课

      Your body wasn’t built to last: a lesson from human mortality rates

      文章从人类死亡率随年龄变化的统计规律出发,解释身体并非为长久使用而设计:年轻时死亡风险较低,之后随年龄近似指数上升,像复杂系统在不断累积损伤。

      科学与数学上首页 5 次 · 2009–2018gravityandlevity.wordpress.com

    打赏支持

    打赏二维码

    觉得有用,请作者喝杯咖啡。

    WeChat

    关注向阳乔木

    微信公众号「向阳乔木推荐看」

    微信公众号「向阳乔木推荐看」二维码

    微信扫一扫;在微信里打开本页时,长按二维码识别。