CycloWizard
Lifer
- Sep 10, 2001
- 12,348
- 1
- 81
I wasn't sure, and I can't seem to find a statistics book anywhere around here, so I (being SuperDork®), decided I'd write a MATLAB program that tested it really quickly. I had 1000 sets of coin tosses with each set containing 1,000,000 tosses. This lets you look at the results from a smaller sample (a million tosses) and the results from a larger sample (a billion tosses). The results:Originally posted by: TuxDave
I'm just doing: Limit as n goes to infinity of
[number of situations of n heads in 2n tosses]/[total number of possibilities].
to prove that as you go to an infinite number of tosses, the probability of getting n heads out of 2n coin tosses does not go to 1.
I'm not clear on where and how I'm using an incorrect distribution type.
1000 sets of tosses:
More Heads: 483
More Tails: 517
Overall count:
Heads: 499975993
Tails: 500024007
The code I used:
<code>
for j=1:10^3
for i=1:10^6
seed=rand();
if seed<0.5
Heads(j)=Heads(j)+1; %heads
else
Tails(j)=Tails(j)+1; %tails
end
end
end
sumHeads=0;sumTails=0;
Headswins=0;Tailswins=0;
for k=1:10^3
if Heads(k)>Tails(k)
Headswins=Awins+1;
else
Tailswins=Tailswins+1;
end
sumHeads=Heads(k)+sumA;
sumTails=Tails(k)+sumB;
end
[Headswins,Tailswins]
sumHeads
sumTails
</code>
edit: Do the code tags only work in software, or did I forget what the right tag is?