Discussion about this post

User's avatar
lcamtuf's avatar

Three postscripts:

1) The idea for the game comes from a book by Robin Pemantle and Julian Joseph Gould: https://www.amazon.com/dp/1032870346 . That said, the book is less accessible and uses differently-structured proofs.

2) To recreate the plots in the article, you can calculate scores this way:

tgt_b = target_float * b;

high_alpha = floor(tgt_b) + 1 - tgt_b;

low_alpha = tgt_b - ceil(tgt_b) - 1;

...where target_float is the representation of the number you're approximating and low_alpha / high_alpha are the low-side and high-side errors you can plot. My implementation using arbitrary precision floats can be found here: https://lcamtuf.coredump.cx/blog/gmp_approximator.c

3) Rational numbers have a limited number of 2-good approximations and these approximations tend to be crummy. But if you want to construct a rational with some number of nice approximations... well, just take some of the initial digits of π!

VK's avatar
Mar 11Edited

I've always found a good way to get a geometric intuition about this fact is to think of the denominator and numerator of the rational approximation as two orthogonal axes with integer values. A lattice of points going from 1-... on each axis forming a 2D lattice of dots.

An irrational number is represented as a line that you draw from the origin through the lattice that *never* touches any of the infinite lattice points. It's slope is the numerical value.

But it is easy to see that the line gets awfully close to some lattice points. Arbitrarily close.

It is fun to actually try to do this on graph paper. It's really hard to draw a line and *not* hit any dots, even for a small lattice like 20x20.

Wikipedia has a pretty good image:

https://en.wikipedia.org/wiki/Integer_lattice#/media/File%3ADiophantine_approximation_graph.svg

No posts

Ready for more?