Topics /

Math & Algorithms

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

Any year
2192

What is the roundest country?

We can define roundness in many ways. For example, as you may know, the circle is the shape that given a fixed perimeter maximizes the area. This definition has many problems. One of the problems is that countries generally have chaotic perimeters (also known as borders), so they tend to be much longer than they seem…

2197

Magic: The Gathering Is Turing Complete (v5)

I'm assuming you're familiar with the basic idea of what a Turing machine is . There are a few parts to building one in Magic: a tape extending in two directions storing cells of a few different "colours"; a processing head that can read the current cell's colour, write a new colour and change its state if necessary…

2199

Random Points on a Sphere

John D. Cook, Greg Egan, Dan Piponi and I had a fun mathematical adventure on Twitter. It started when John Cook wrote a program to compute the probability distribution of distances $latex |xy &#82…

2200

Inspecting C's qsort Through Animation

The C standard library includes a qsort() function for sorting arbitrary buffers given a comparator function. The name comes from its original Unix implementation, “quicker sort,” a variation of the well-known quicksort algorithm. The C standard doesn’t specify an algorithm, except to say that it may be unstable (C99…

2201

Algebraic graph calculus (2021)

We describe a graph-theoretic analogue of vector calculus. The linear operators of vector calculus (gradient, divergence, laplacian) correspond to the matrices naturally associated to graphs (incidence matrix, adjacency matrix). This analogy is useful for formalizing the discretization of some problems in image and…

2203

Sparse Matrices (2019)

A sparse matrix is a matrix that has a value of 0 for most elements. If the ratio of N umber of N on- Z ero ( NNZ ) elements to the size is less than 0.5, the matrix is sparse. While this is the mathematical definition, I will be using the term sparse for matrices with only NNZ elements and dense for matrices with all…

2207

An Introduction to Lagrange Multipliers

Lagrange multipliers are used in multivariable calculus to find maxima and minima of a function subject to constraints (like "find the highest elevation along the given path" or "minimize the cost of materials for a box enclosing a given volume"). It's a useful technique, but all too often it is poorly taught and…

2213

Time Travel (2006)

Last time we talked about free will, superintelligent predictors, and Dr. Evil planning to destroy the earth from his moon base. Today I'd like to talk about a more down-to-earth topic: time travel. The first point I have to make is one that Carl Sagan made: we're all time travelers—at the rate of one second per…