Speeding up atan2f
`atan2f` is an important but slow trigonometric function. In this article we'll explain how to approximate it, and implement a version 50x faster than `glibc` on batches of inputs.
Topics /
The most popular blog posts about math & algorithms on Hacker News. 135 posts.
`atan2f` is an important but slow trigonometric function. In this article we'll explain how to approximate it, and implement a version 50x faster than `glibc` on batches of inputs.
If I multiply two 64-bit integers (having values in [0, 264)), the product requires 128 bits. Intel and AMD processors (x64) can compute the full (128-bit) product of two 64-bit integers using a single instruction (mul). ARM processors, such as those found in your mobile phone, require two instructions to achieve the…
Recently I was doing some work decoding the new Galileo High Accuracy Service data. In short, this new service will allow Galileo (“European GPS”) users to achieve decimeter-level accuracy, which is nice. This “HAS” data is transmitted highly redundantly by making good use of Reed-Solomon encoding. To work with this…
Doga Tekin's website.
I posted on When did Math get so hard? a commenter pointed out that one can also ask When did Computer Science Theory Get so Hard? For t...
Once upon a time we were creatures in the wilderness and we evolved the ability to hear sounds. Now here's an interesting thing, if you hear a sound of frequency f and others of frequency 2f, 3f, etc then there's a good chance these sounds come from the same object, due to the physical principle of resonance . And so…
Most undergraduate computer sciences courses teach students about tail call optimization (TCO) , and even if you don't have a formal computer science background the concept is talked about enough that you might be familiar with it anyway, especially if you've ever done any functional programming. However, I think the…
Leo’s third grade class got to try a Noyce Foundation math worksheet [1] the other day. They didn’t fare so well, but I gotta tell you, some of the problems are REALLY hard! In fact, on…
This is a followup to my previous post on the stack monoid, but is intended to be self-contained.
In this article I’m trying to explain the difference/similarities between dynamic programing and divide and conquer approaches based on two examples - binary search and minimum edit distance (Levenshtein distance)
FizzBuzz is a common coding problem asked in technical screenings or interviews. It goes something like this:
<meta http-equiv=
Finding provably optimal strategies for 2048 using Markov Decision Processes
Packing up the household for a recent move, I was delving into shoeboxes, photo albums, and file folders that had not been opened in decades. One of my discoveries, found in an envelope at the back of a file drawer, was the paper sleeve from a drinking straw, imprinted with a saccharine message:
An introduction to the TCC course “Formalising Mathematics”
Using the power of randomness to answer scientific questions.
Andrej has invited me to write about certain surprising functional programs. The first program, due to Ulrich Berger (1990), performs exhaustive search over the “ Cantor space ” of infinite sequences of binary digits. I have included references at the end. A weak form of exhaustive search amounts to checking whether…
We describe a set of very unusual dice, and a two player game where you will always have the advantage. You can even teach your opponent how the game works, yet still win again! Finally, we will describe a new game for three players where you can expect to beat both players at the same time! Watch James Grime and…
Machine learning systems thrive on finding and exploiting statistical regularities. This is why they can't do causal reasoning.
Stephen Wolfram considers if numbers are actually required, the use of symbolics and the potential for the growing role of computational irreducibility.
One of the easiest ways to start a (friendly) fight in a group of mathematicians is to bring up the axiom of choice. I'll explain what it is, why it's so controversial, and hopefully shed some light on how we choose axiomatic systems and what that means for the math we do.
Stephen Wolfram shares a glimpse into his conversations with Solomon Golomb, developments on shift registers, polyominoes, scientific contributions.
Programming in logic can help you produce better optimized, more secure, bug-free code … if only you knew how to do it.
Blog of Raph Levien.
A bloom filter is one of those data structures you are probably already aware of, or have at least heard about. For those looking for a simple recap, they are a probabilistic data structure which can …
This post explores some concepts behind Gaussian processes, such as stochastic processes and the kernel function. We will build up deeper understanding of Gaussian process regression by implementing them from scratch using Python and NumPy.
The python code that goes along with this blog post can be found at To evaluate the quality of a blue noise texture, you can analyze it in frequency space by taking a discrete Fourier transform. Wh…