Re: probability with simulation
- To: mathgroup at smc.vnet.net
- Subject: [mg60507] Re: probability with simulation
- From: Bill Rowe <readnewsciv at earthlink.net>
- Date: Mon, 19 Sep 2005 04:45:28 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
On 9/18/05 at 1:15 AM, ma_sara177 at hotmail.com (Sara) wrote: >I have a problem with probability. I have to solve a problem av >probability with simulation. i have done it with the combinatorial >method but I dont know how to use Mathematica to solve the problem >with simulation. can any one Help me please. If you want my result >with combinatorial method or my try with simulation I can email >you. the problems are: >1)Find the probability of getting exactly two 1:s when throwing 5 >dices. Solve this problem with the combinatorial method and by >simulation. From what you say above, I assume the difficulty is with the Mathematica code rather than the problem itself. I can simulate a single die with Random[Integer,{1,6}] So a set of five dice could be represented as Table[Random[Integer, {1,6}],{5}] using Count to count the number of 1's in each simulate toss of 5 dice you get the following; Count[Table[Random[Integer,{1,6}],{5}],1] Finally if I wanted to simulate 1000 rolls of the 5 simulated dice and count just the number of times exactly two 1's appeared, I could do it as Count[ Table[ Count[Table[Random[Integer, {1, 6}], {5}], 1], {1000}], 2] -- To reply via email subtract one hundred and four