So, in the previous post, I posed a question and claimed no answer. But a very interesting answer it turned out to be.
Consider the sequence defined by for n = 1, 2, 3, 4, … We start at n = 1, to avoid the fact that Sin(0) = 0, which technically has no sign. Computing the first terms of this sequence
1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, …
Which is nearly a complete mess. However, looking through said mess, you may notice a pattern. The 1’s and -1’s always come in groups of 3 or 4. If we go through and group like terms and count, we get the following sequence.
3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 4, 3, 3, …
Now this is increasingly interesting. Looking at the terms above, observe that we have 27 threes and 4 fours. Taking the average,
Intrigued yet? Taking the first 1000 terms of the sign sequence, we get 273 threes and 45 fours, for an average of 3.141509434.
So it seems that the running average of ‘likeness-counts’, I guess we’ll call them, converges to pi.
Which is neat. And, at least after the fact, certainly seems intuitive. Though I wouldn’t mind an explanation of this that minimizes handwaving. Hmmm.
lol..
sign(sin(n))
Q: Why didn’t you do your trigonometry homework?
A: My lawyer told me not to sign anything without his presence.
Comment by Mgccl — September 23, 2008 @ 6:38 pm
How about (just taking the +1’s here) :
- The points that generate the first +1’s in a group are uniformly distributed in [0,1) mod 2 pi
- We have a group of 4 only if the point is < 0.1415… mod 2 pi.
So
P(group of 4) = 0.1415…
P(group of 3) = 1 – 0.1415…
Expected value = 3.1415…
Comment by Sander — September 23, 2008 @ 6:44 pm
You can do even better by just looking at the +1’s and -1’s: if we’ve seen the first n +1’s and -1’s in the sequence, and there have been t transitions from +1 to -1 or vice versa so far, then it’s not too hard to see that
t*pi < n < (t+1)*pi
and therefore
n/(t+1) < pi < n/t.
This should generally be a more accurate estimate than the averaging 3’s and 4’s thing (since, on average, the denominators will be larger by a factor of… well… pi =).
Comment by Brent — September 24, 2008 @ 1:44 am
Wait, I’m being silly. What I said is exactly the same as averaging the 3’s and 4’s! The number of 3’s and 4’s is exactly the number of transitions, and the sum of all the 3’s and 4’s is just the total number of +1’s and -1’s we’ve seen so far. So the average of the 3’s and 4’s is the same as n/t in my notation. So now hopefully it should be more clear why these methods work.
The probability argument is nice and simple too, although it relies on the uniform distribution of multiples of pi (mod 1) — which is true, since pi is irrational, but not trivial to prove.
Comment by Brent — September 24, 2008 @ 11:39 am