Here's my thinking about the theoretical probabilities.s (Here an AFL win
is an 8) ]
td=: fd (6*2=y)+ y=:, 2+1{."1 I.3=+/\"1 #:i.64
4 8
5 12
6 12
7 10
8 22
]tpd=:(4+i.5),. ({:"1 td) %+/{:"1 td
4 0.125
5 0.1875
6 0.1875
7 0.15625
8 0.34375
I haven't had time to figure out why we disagree. More later.
Linda
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Kip Murray
Sent: Monday, February 13, 2012 2:03 PM
To: Programming forum
Subject: Re: [Jprogramming] Challenge 5 Super Bowl Supposition
Here is a partial solution to Linda's Challenge 5. --Kip Murray
Let us call the teams A and B. A has won the first game of a seven game
series, and there are up to six games to go. I deal with the question
of whether A wins the series, ignoring the matter of how many games are
required. Each game is played until there is a winner -- there are no ties.
Let us imagine the teams play all six remaining games even if the series
is decided before the sixth remaining game. Because the teams are
equally matched, the six remaining games are equivalent to six tosses of
a fair coin with sides 0 and 1, where 1 means a win by team A. A key
idea is that A wins the series if A wins three or more of the remaining
six games, because then A has won four or more games in all and B has
won at most three games in all.
The binomial distribution (x!y)%(2^y) gives the probability of obtaining
exactly x heads in y tosses of a fair coin. For six tosses the
probabilities are shown in the table
(] ,: (2^6) %~ 6 !~ ]) i.7
0 1 2 3 4 5 6
0.015625 0.09375 0.234375 0.3125 0.234375 0.09375 0.015625
We find the probability of three or more heads by summing:
([: +/ 3 }. (2^6) %~ 6 !~ ]) i.7
0.65625
That is the theoretical probability that A wins the series, given that A
has won the first game.
Verb winpct below simulates y repetitions of tossing a fair coin 6 times
and returns the percent of those y repetitions which resulted in 3 or
more heads. (Heads is 1, tails is 0.)
winpct =: 100 * ] %~ [: +/ 3 <: [: +/ [: ? 2 $~ 6 , ]
winpct 2000000
65.6252
winpct"0 [ 5#2000000
65.5622 65.6496 65.599 65.6166 65.6298
On 1/31/2012 3:46 AM, Linda Alvord wrote:
> Challenge 5 Super Bowl Supposition PLEASE DO NOT RESPOND UNTIL 2/6/2012
12
> am EST
>
>
>
> As the Super Bowl approaches, suppose it will be decided like baseball.
Four
> of seven games determines a winner. Also suppose that the NFL has won the
> first game.
>
>
>
> Simulate results of 2000000 series and provide the number of times the NFL
> wins in 4 5 6 7 games. If the AFL wins this Extended Super Bowl
> Contest, the result is an 8 . Create a 2000000 item list of number of
> games necessary to determine a winner and provide a frequency
distribution.
>
>
>
> fd=: [: /:~ ({. , #)/.~
>
> fd (expression for 2000000 trials)
>
> 4 249561
> 5 374865
> 6 373851
> 7 312603
> 8 689120
>
> ]games=:fd n,.2000000$6
>
> 4 249301
> 5 376266
> 6 375281
> 7 311189
> 8 687963
>
> ]prob=:(4+i.5),. (1{"1 games)%2000000
>
> 4 0.124651
> 5 0.188133
> 6 0.18764
> 7 0.155595
> 8 0.343982
>
>
>
> ]+/(1{"1 games)%2000000
>
> 1
>
>
>
> Now, confirm that your results are reasonable with a theoretical
argument.
>
>
>
> Also, enjoy the Super Bowl!
>
>
>
> Linda
>
>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm