*To*: mathgroup@smc.vnet.net*Subject*: [mg12003] Re: A Monte Carlo Simulation with loop structure*From*: Carl Woll <carlw@fermi.phys.washington.edu>*Date*: Fri, 17 Apr 1998 03:40:39 -0400*Organization*: University of Washington*References*: <6gr6oo$8n4@smc.vnet.net>

Hi Daniel, It seems to me that the number of triples which sum to 10 is more than the number of triples which sum to 9. For example, consider the following code which evaluates all possible triples trip = Flatten[ Table[i+j+k, {i,6}, {j,6}, {k,6}] ]; Count[trip,9] Count[trip,10] 25 27 and so there are 2 more possiblilities for 10. As far as programming a Monte Carlo simulation, one idea is the following z := Random[Integer,{1,6}] roll := z + z + z monte[n_]:=Table[roll,{n}] simulation = monte[10000]; Count[simulation,9] Count[simulation,10] Carl Woll Dept of Physics U of Washington On 12 Apr 1998, Daniel Sanders wrote: > Hi, > I"m learning Mathematica programming in AutoDidactic [mode], and > I'm working on conditionals and loop structures. The problem that follows > is prototypical, and perhaps I can benefit from seeing some of your > solutions. > I owe the problem to J. Laurie Snell from his book, "Introduction to > Probability". > In the early 1600s, Galileo was asked to explain the fact that, > although the number of triples of integers from 1 to 6 with sum 9 is > the same as the number of such triples with sum 10, when three dice are > rolled, a 9 seemed to come up less often a 10 supposedly in the experience of > gamblers. > Can you suggest native Mathematica code not emulating a procedural > language for a Monte Carlo simulation experiment that runs many times > keeping track of the proportions of 9s and 10s? Thanks in advance, > I'm interested in the looping mechanism. > > Daniel Sanders > > > > >