View Single Post
Old 01-13-2007, 04:07 PM  
nick3131
Confirmed User
 
Join Date: Dec 2004
Location: Gainesville, Florida
Posts: 1,193
Quote:
Originally Posted by interracialtoons View Post
The answer to your orginal question is

Odds = 28/256 or 10.9%



The answer to the five sided coin is

Odds = 114688/390625 or 29.4% rounded



To show how I got the answer I will a simple example to prove the math

* A guy jumps out of a car, he will either land on his Head, Ass or feet.
What are the odds he will land on his Head exactly 2 times if he jumps
3 times.

The odds are calculated by determining all possibilties of his landings
over three jumps.

So he could land:
head, ass, feet (012) or
head, head, ass (001) or
ass, feet , head (120) etc.....

A total of 27 possiblities

But we are only interested about him landing on heads twice which means
these possible sets:

head,head,ass
head,head,feet
head,ass,head,
head,feet,head
ass,head,head
feet,head,head

A total of 6 relevent sets

No other sets satisifies our criteria.




Now run this simple perl script to prove my math




PERL cgi
------------

#!/usr/bin/perl
print "Content-type: text/html\n\n";


### copy right, 2007 interracialtoons.com


$head_ass_feet = "012"; ##### possible landings; head=0 ass=1 feet=2


@one = split(//, $head_ass_feet); #### array @one @two...etc are trys in the set of attempts
@two = @one;
@three = @one;

$total_permutes = 0; #### the total possible out comes of all trys in attempts
$heads2times = 0;

$a = 0;
foreach (@one) {
$b=0;
foreach(@two) {
$c = 0;
foreach (@three) {
$countheads = 0;

if ($one[$a] == 0) {$countheads++;}
if ($two[$b] == 0) {$countheads++;}
if ($three[$c] == 0) {$countheads++;}


print "$one[$a]$two[$b]$three[$c]<br>"; #### Dont print for 8 shots! Too many!

if ($countheads == 2) {$heads2times++;} #### head must occur EXACTLY 2 times

if (-e "killthisshit.txt") {print "ABORTED"; exit;}
$total_permutes++;

$c++;}
$b++;}

$a++;}


print "Total Permutations = $total_permutes<br><br>";
print "Heads occured exactly 2 times = $heads2times<br><br>";
print "Odds = $heads2times/$total_permutes<br><br>";



exit;



---END PERL---


RESULT ------

All The possible results of 3 trys

000
001
002
010
011
012
020
021
022
100
101
102
110
111
112
120
121
122
200
201
202
210
211
212
220
221
222
Total Permutations = 27

Heads occured exactly 2 times = 6

Odds = 6/27

Only one of the above permutations will happen in 3 trys

The odds reduce to 2/9 or 1 in 4.5 = 22% rounded





NOW run this program which has the exact same math but uses the
five sided coin in your example with sides = head, arm1, arm2, leg1, leg2



#!/usr/bin/perl
print "Content-type: text/html\n\n";





$head_arm1_arm2_leg1_leg2 = "01245"; ##### possible landings; head=0 arm1=1 arm2=2 ...


@one = split(//, $head_arm1_arm2_leg1_leg2); #### array @one @two...etc are trys in the set of attempts
@two = @one;
@three = @one;
@four = @one;
@five = @one;
@six = @one;
@seven = @one;
@eight = @one;

$total_permutes = 0; #### the total possible out comes of all trys in attempts
$heads2times = 0;

$a = 0;
foreach (@one) {
$b=0;
foreach(@two) {
$c = 0;
foreach (@three) {
$d = 0;
foreach (@four) {
$e = 0;
foreach (@five) {
$f = 0;
foreach (@six) {
$g = 0;
foreach (@seven) {
$h = 0;
foreach (@eight) {


$countheads = 0;

if ($one[$a] == 0) {$countheads++;}
if ($two[$b] == 0) {$countheads++;}
if ($three[$c] == 0) {$countheads++;}
if ($four[$d] == 0) {$countheads++;}
if ($five[$e] == 0) {$countheads++;}
if ($six[$f] == 0) {$countheads++;}
if ($seven[$g] == 0) {$countheads++;}
if ($eight[$h] == 0) {$countheads++;}

#####print "$one[$a]$two[$b]$three[$c]<br>"; #### Dont print for 8 shots! Too many!

if ($countheads == 2) {$heads2times++;} #### head must occur EXACTLY 2 times

if (-e "killthisshit.txt") {print "ABORTED"; exit;}
$total_permutes++;


$h++;}
$g++;}
$f++;}

$e++;}

$d++;}

$c++;}
$b++;}

$a++;}


print "Total Permutations = $total_permutes<br><br>";
print "Heads occured exactly 2 times = $heads2times<br><br>";
print "Odds = $heads2times/$total_permutes<br><br>";



exit;

---END PERL---






Now run the script for your orginal question


#!/usr/bin/perl
print "Content-type: text/html\n\n";





$hit_miss = "01"; ##### possible landings; hit=0 miss=1


@one = split(//, $hit_miss); #### array @one @two...etc are trys in the set of attempts
@two = @one;
@three = @one;
@four = @one;
@five = @one;
@six = @one;
@seven = @one;
@eight = @one;

$total_permutes = 0; #### the total possible out comes of all trys in attempts
$heads2times = 0;

$a = 0;
foreach (@one) {
$b=0;
foreach(@two) {
$c = 0;
foreach (@three) {
$d = 0;
foreach (@four) {
$e = 0;
foreach (@five) {
$f = 0;
foreach (@six) {
$g = 0;
foreach (@seven) {
$h = 0;
foreach (@eight) {


$countheads = 0;

if ($one[$a] == 0) {$countheads++;}
if ($two[$b] == 0) {$countheads++;}
if ($three[$c] == 0) {$countheads++;}
if ($four[$d] == 0) {$countheads++;}
if ($five[$e] == 0) {$countheads++;}
if ($six[$f] == 0) {$countheads++;}
if ($seven[$g] == 0) {$countheads++;}
if ($eight[$h] == 0) {$countheads++;}

#####print "$one[$a]$two[$b]$three[$c]<br>"; #### Dont print for 8 shots! Too many!

if ($countheads == 2) {$heads2times++;} #### head must occur EXACTLY 2 times

if (-e "killthisshit.txt") {print "ABORTED"; exit;}
$total_permutes++;


$h++;}
$g++;}
$f++;}

$e++;}

$d++;}

$c++;}
$b++;}

$a++;}


print "Total Permutations = $total_permutes<br><br>";
print "Heads occured exactly 2 times = $heads2times<br><br>";
print "Odds = $heads2times/$total_permutes<br><br>";



exit;


----END PERL----



That's the real math!

BUT Wait.

Lets make his shooting stick to 20%

meaning $hit_miss = "01111"; ##### possible landings for this 20% user is 1 in five hit=0 miss=1

The question here though is "is this valid" to respresent his shooting as such

Now run the last script with the new hit miss value.

The result is the same as the five sided coin.






Conclusion:

I can flip your five sided coin 1000 times a day for 30 days
and get a different heads percentage every day!
I can factor these together and get my total heads percentage for those
days and it could be 50%(or 20% shooting from that spot) or any number but when I do it on the 31st day
the math will still be the same as every other day reguarless of the
percentage I compiled previously.

Therefore the mathematical odds never change bases on my previous success rate of flipping
and getting heads.

Just because you can factor some numbers and get a result does not mean the
result is meaningfull.

So. The orignal question has no "meaningfull results".


BUT if the shooter had attempted 8 shots a day for 30 days and he got exactly 2 hits
on 10 days then that would yield a 30% chance he would do it today but that has nothing to do with his
overall percentage of 20%. You didn't provide the needed information to actually find
a meaningfull result.
here's a simpler way to solve this using programming

this is a code i wrote in mirc scripting to solve this problem

Code:
alias timmy {
  set %loop 0
  set %loop2 0
  set %chances 0
  :loop
  set %loop2 0
  if (%goals == 2) { inc %chances } 
  set %goals 0
  if (%loop >= 80000000) { goto end }
  :loop2
  inc %loop2
  if (%loop2 > 8) { goto loop }
  set %timmy $rand(1,5)
  if (%timmy == 1) { inc %goals }
  inc %loop
  goto loop2
  :end
  echo 4 %chances
}
__________________
Signed nick3131

nick3131 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote