User talk:Tennessee Ernie Ford/Archive 08

Maths: Runs of heads
Did you find a formula for the probability of a run ? Because it seems to me that for a large number of throws, to compute a close approximation seems not very hard when the approach is right.

For a large number of throws, the expected length of a run is 2.
 * To come up with the expected (average) length of a run E, given an infinite number of throws, consider this: A run is either of length 1 (50%), or it is longer than 1 (50%). If it is longer, then after the first throw, we're again in the initial situation, so its expected length after the first throw will be the expected length E, totalling E+1. Thus, E = 1/2 * 1 + 1/2 * (E+1). Solve for E to get E=2.
 * If we had only 6 throws, the expected length would be a lot less, because a run starting on the first throw would be limited to length 6, and a run starting on the 5th throw (which probably happens 1/4 of the time) could only have a maximum of 2, and so would have an average length of only 1.5. So in theory I'd need to come up with a formula to compute the expected length of a run as a sum of the probability that a run will start on a certain position times the expected length for that position, but for a large number of throws most of these addends would be very close to 1/n * 2, making the result so close to 2 that I won't bother.

If we have n runs of heads or tails, the probability of seeing a run of heads of length k or over is R(k) = 1 / 2^k.
 * Check this for k=1 : there's a 50% chance that the run will be of heads, and any such run will certainly be length 1 or over, or it wouldn't be a run, so 1/2^1 = 1/2 is correct. Having a run that is lonnger by one is half as likely, etc.

To find how many runs (n) we have to observe to see at least one run of length k with probability p, we simply solve (1 - R(k))^n = (1-p) for n, which gives n = log(1-p) / log(1 - R(k)).

Multiply by the expected length of a run, and you have the average number of throws required: N = 2 * log(1-p) / log(1 - 1/2^k)

For a run of k=10 heads and p=50%, this comes out to 1419 throws; and 14189 throws for p=1023/1024. For validation, this is fairly close to what the excel computation arrived at, that method is prone to suffer from propagating numeric rounding errors. --◄mendel► 08:52, 10 April 2011 (UTC)


 * I'm not sure what you are asking me. This came up when I was testing DDG vs Google by asking something like, how likely is it to get 50 heads in a row. This was only one of many results. The only reason I linked is that it includes examples of people writing clearly, people who obscure their ideas through unfortunate rhetorical choices, and that neither type of writing implied whether their analysis was accurate. Whether anyone addressed the question 100% correctly is to me, moot.


 * I wasn't particularly interested in the answer per se, I was interested in whether Google or DDG gave me a good shot at anything valuable. And, to a lesser extent, whether someone who was bad at math could get an accurate and useful answer.


 * As you can see, the (ahem) odds of getting a valuable answer by randomly selecting a result were poor even if one understands math; the chances (ahem) of being misled by a clear (but incorrect) answer were high.


 * And, for what it's worth, I couldn't find anything (without digging deeper) that was both as clear and as accurate as your analysis above. The excel version might have been accurate (within rounding areas, as you note), but was hard to parse unless you are good at Excel and math. The easier-to-read examples tended to miss something critical.  — Tennessee Ernie Ford ( TEF ) 17:11, 10 April 2011 (UTC)


 * Well, to me, it seemed like normal mathematical discussion on the 'net, with people responding to different aspects of the problem and at different levels of mathematical understanding - and some levels were probably not well suited to the person who originally asked the question. However, whether an answer sounds good and is adapted to the person who asked for it is indeed no guarantee that it is accurate - to judge that, you need to know more about the subject matter. I guess that's the difference between getting an answer and getting an education. ;-P And there are still too few people around who are educated in privacy. --◄mendel► 04:08, 11 April 2011 (UTC)


 * Yes, it was a completely typical discussion (mathematical or otherwise). — Tennessee Ernie Ford ( TEF ) 06:25, 11 April 2011 (UTC)
 * a typical discussion? (youtube link)
 * via Robot Beach, --◄mendel► 15:22, 11 April 2011 (UTC)

Ernie
/wave =) A F K When Needed 19:31, 13 April 2011 (UTC)


 * Hey! wb. (or are you just lurking intermittently?) What's new in the world of AFKness? — Tennessee Ernie Ford ( TEF ) 20:18, 13 April 2011 (UTC)


 * Well, he's a free kill, as always. --[[Image:El Nazgir sig.png|Talkpage]]El_Nazgir 21:15, 13 April 2011 (UTC)
 * Get outta here you strange, floating individual.
 * I tend to be lurking even when not editing; though I'm certainly not on here every day. Not much is new (yet - hopefully will have a lot to tell at the end of the summer) with me, anything exciting happening in your life?
 * (Is this the first time ever you accepted Ernie as being directed at you? That one's going on the calendar.) A_F_K_sig_2.jpg A F K When Needed 22:12, 14 April 2011 (UTC)


 * I accepted your wave; I didn't actually notice the header until just now.


 * Anyhow, there's never been anything wrong with Ernie, it's just that until I had been at this wiki for over a year, I never had anyone refer to me by that term...and I've been using this userID to post about RPGs for a very, very long time. In some ways, it's the more obvious choice. — Tennessee Ernie Ford ( TEF ) 23:42, 14 April 2011 (UTC)
 * You still have yet to object to the header.
 * Which, co-incidentally, proves you owe me €50. A_F_K_sig_2.jpg A F K When Needed 00:39, 15 April 2011 (UTC)
 * Takes the 50 and runs* weee, more alcohol!!!! (just kidding) Ariyen 04:23, 15 April 2011 (UTC)
 * Woman, you might want to get out of that sunny patch. I think it's going to your head... Arnout aka The Emperors Angel 07:35, 15 April 2011 (UTC)
 * Hai Arnout, how's u? A_F_K_sig_2.jpg A F K When Needed 10:17, 15 April 2011 (UTC)
 * Fine, thank you. Aryen stole my sunny patch and my cold beverage, thats all. Arnout aka The Emperors Angel 14:08, 15 April 2011 (UTC)
 * "beverage" ;) ∵Scythe∵ 19:29, 15 April 2011 (UTC)