I saw this and pretty much immediately wanted to look at how the parts within the absolute value
|x - p/q|
would change given different values of x, p, and q.
I started writing C code. Ran a couple of FOR loops over p and q, going from 1 to 1024 (starting at 1 to void a divide by zero, stop at 1024 is mostly arbitrary). Set x to the value of pi (in the C libraries, that value is M_PI).
Looking at this very simple equation, I see that if x = p/q, then the value is going to be zero. For numbers like pi, there is no ratio of integers that would be exactly equal. So for pi, this value would never be zero, but it could probably be close.
So then I can run this code and then plot p vs q vs |x - p/q|, and see what it looks like.
Fascinating is my first reaction, and then confusion.
Here is q (x-axis) versus |pi - p/q| (y-axis) going from 1 to 1024 on the x-axis, and 0 to 5 on the y-axis:
The flat plateau is approximately the value of pi (indicating that the ratio p/q is very very very small). The two curved lines meet at the bottom at 1024 / pi (about pixel 326). The curve going up and to the right is asymptotically going towards the value of pi. The internal structure might be an interference byproduct of the size of the points plotted and their position.
Here is p (x-axis) versus |pi - p/q| (y-axis) going from 1 to 1024 on the x-axis, and 0 to 5 on the y-axis:
This one is confusing. The far left starts at a value of pi, but I have no idea what that slope is. There's also other structures in there, plus some of the same likely interference patterns.
I can look at the lowest values versus the value of p. The red dots indicate the lowest values (very very close to zero, but not quite -- meaning that this ratio is very close to the value of pi)
Here are the corresponding q values (note they end at an x-axis value of about 1024 / pi):
Looking at these two lowest values, the ratios are:
355 / 113 = 3.14159292 (difference of 0.0000002667..., the 7th decimal place)
710 / 226 = 3.14159292
(these are the same thing, an example of what the paper calls 'coprime', I think). So in this range (letting p and q go from 1 to 1024), there is ONE ratio that is pretty close to pi, and a harmonic.









No comments:
Post a Comment