Re: Interesting Simulation Problems....
- To: mathgroup@smc.vnet.net
- Subject: [mg12226] Re: [mg12084] Interesting Simulation Problems....
- From: "Dr. Tomás Garza"@smc.vnet.net
- Date: Fri, 1 May 1998 03:09:13 -0400
LinLi wrote:
> the following are some interesting simulation problems. Just
> wonder how i can do it with mathematica ....
> 1. Problem of Points
> Suppose there are two players and each player has an equal chance to
> win a round.
> The players agree to play 10 rounds for a pot of $100. After player
> A has won 5 rounds
> and player B has won 3 rounds, they are forced by unforeseen
> circumstances to stop.
> how should they then fairly divide the pot? (Use Simulation to
> solve)
LinLi, here goes an approach to problem 1 (I expect these are not
homework problems). Let the outcome of a round be 1 if A wins, 0
otherwise. Define "rond" to be the outcome of 10 independent rounds,
so that
In[1]:ond:Úble[Random[Integer,{0,1}], {10}]
Now, repeat rond a large number of times, say 100,000, and from this
list of outcomes select those where the sum of the first 8 rounds is 5
(i.e., A has won 5 and B has won 3):
In[2]: Timing[sim
Select[Table[rond,{100000}],Plus@@Take[#,8]Õ&];]
Out[2] {66.95 Second,Null}
Takes slighty over a minute in my 233MHz PC. There are
In[3]:Length[sim]
Out[3]22039
22,039 such cases. Were the game to continue until the 10th round, it
would end in a draw in 5539 cases out of these:
In[4]:Length[Select[sim,Plus@@ # ÓD 5&]]
Out[4]539
Player B has no chance of winning the game, and his only possibility
would be to get half of the pot in case of a draw. So he should be
awarded $50,000 times 5539/22039 .2513, i.e. 12,566. The rest goes
to player A.