Topics /

Math & Algorithms

The most popular blog posts about math & algorithms on Hacker News. 2,391 posts.

Any year
332

Why Do Buses Bunch?

Created by Lewis Lehe (of Setosa and UC Berkeley Trans. Eng. ) with design and art by Dennys Hess . Thanks to Ian Johnson for good advice. Tools: d3 , Angular Material , Coffeescript , Browserify , Gulp and Five-Hour Energy Drink .

335

Estimating square roots in your head

Imagine we want to compute the square root of a number n n n . The basic idea of Heron’s method , named after the mathematician and engineer, Heron of Alexandria, is to find a number g g g that is close to n \sqrt{n} n ​ and to then average that with the number n / g n/g n / g , which corrects for the fact that g g g…

336

Bayesian Statistics: The three cultures

A traditional subjective Bayesian will assume a data generating distribution (aka a likelihood when viewed as a function of the parameters). Then, conditional on this assumption, they encode their prior beliefs as a prior distribution over parameters. After this, they turn the crank on posterior inference and don’t…

345

The Truth About Linear Regression (2015)

This is basically a compilation of the lecture notes I wrote when teaching 36-401, Modern Regression, in fall 2015 . I offer it here on the chance that it might be of interest to those learning, or teaching, linear regression. There's no shortage of resources on that, but I have tried to present the subject as though…

350

“Why not just use Lean?”

I have been told that when proposing to formalise mathematics these days, you have to explain why you are not using Lean. And that reminds me why I left the dependent-typed world 40 years ago: its cultism, insularity and conformity. Lean is a great language with good tools, a large library and a huge, enthusiastic…

352

Functorio

You might have heard people say that functional programming is more academic, and real engineering is done in imperative style. I’m going to show you that real engineering is functional, and …

353

A Branchless UTF-8 Decoder

This week I took a crack at writing a branchless UTF-8 decoder: a function that decodes a single UTF-8 code point from a byte stream without any if statements, loops, short-circuit operators, or other sorts of conditional jumps. You can find the source code here along with a test suite and benchmark:

354

Why isn't there a replication crisis in math?

The replication crisis is a major problem in medicine and social science; we know that a huge fraction of the published literature is outright wrong. But in math we don't seem to have a similar crisis, despite reasonably frequent minor errors in published papers. Why not, and what can this tell us about the fields…