Re: The two dices
- To: mathgroup at smc.vnet.net
- Subject: [mg54542] Re: [mg54486] The two dices
- From: Chris Chiasson <chris.chiasson at gmail.com>
- Date: Tue, 22 Feb 2005 04:24:53 -0500 (EST)
- References: <200502210844.DAA27242@smc.vnet.net>
- Reply-to: Chris Chiasson <chris.chiasson at gmail.com>
- Sender: owner-wri-mathgroup at wolfram.com
Try increasing n to see if your original formulation of the problem is correct.
n = 300000;
theThrows = Table[Random[Integer, {1, 6}] + Random[Integer, {1, 6}], {n}];
theStats = Table[Count[theThrows, i], {i, 2, 12}]
ListPlot[theStats, PlotJoined -> True]
That plot does not look like a Gaussian distribution to me.
For your dice function, try something such as:
Dice = Function[{myMin, myMax}, Random[Integer, {myMin, myMax}]]
Dice[1, 6]
Regards,
On Mon, 21 Feb 2005 03:44:57 -0500 (EST), Antoine <bugaboo12703 at yahoo.fr> wrote:
> Hello,
>
> I wanted to simulate the throws of two dices and something happened I can't
> explain:
> (Mathematica 5.0 , the same occurs on Mathematica 5.1 )
>
> The following code is OK:
>
> n=300;
> theThrows = Table[Random[Integer, {1, 6}] + Random[Integer, {1, 6}], {n}];
> theStats = Table[Count[theThrows, i], {i, 2, 12}]
>
> the occurences, as n becomes greater and greater, looks like the Gaussian
> curve
> (sorry for my English)
>
> Suppose you want your dice function, and that it is defined by
>
> dice[]:=Random[Integer, {1, 6}] ( nothing wrong about it, I suppose )
>
> Now the behavior of the following code changes depending on the value of n.
> If n < 250 everything is fine ...
> hen n >= 250, then there is no occurence of odd values.
> ( the two dices never give 3, 5, ....)
>
> n=250;
> theThrows = Table[dice[] + dice[], {n}];
> theStats = Table[Count[theThrows, i], {i, 2, 12}]
>
> Does a rationnal explanation exists ? Is it a bug ?
>
> The two definitions ( see below ) of the dice function "makes" the code
> running properly.
> But, of course, I prefer the former definition.
>
> dice:=Random[Integer, {1, 6}] ( not so nice, specially if you want to have
> several dice functions)
> dice[_]:=Random[Integer, {1, 6}] ( you must give a parameter to the
> function, quite horrible )
>
> Thank you for your help.
> Antoine
>
>
--
Chris Chiasson
Kettering University
Mechanical Engineering
Graduate Student
1 810 265 3161
- References:
- The two dices
- From: "Antoine" <bugaboo12703@yahoo.fr>
- The two dices