Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How to simulate random samples from crooked coin toss?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg58529] Re: How to simulate random samples from crooked coin toss?
  • From: dh <dh at metrohm.ch>
  • Date: Wed, 6 Jul 2005 03:11:14 -0400 (EDT)
  • References: <dad7vt$41$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Dan,

If you want to simulate the coin tossing problem, remember that
Random[ ] gives a uniformly distributed pseudorandom Real in the range 0 
to 1.
Therefore, if we want to simulate an event with probability P, we check 
if the outcome of Random is below P or not. E.g.
How many heads in n tosses with a crooked coin with P=0.6:

Count[ Table[ If[Random[]<P,1,0] ,{n} ]  ,1]

For y dice, you would check if the outcome of Random =x  is:
x<1/6, 1/6<=x<2/6,..
depending on how many eyes you want.

An additional note:
if you only want a function like:
 > numberOfHeads = coinTosser[infoAboutCoin, numberOfTosses, head]
the problem can be solved without simulations
For your purpose, to describe a coin (dice, cards) you have to specify 
the propability that a certain event happens, e.g. "Head", call it Ph. A 
fine coin would have Ph=0.5, a croocked coin e.g. Ph=0.6.
Now as your coin tosses are all independent, the mean number of Heads in 
n tosses will simply be: n Ph

sincerely, Daniel

DAN BIKLE wrote:
> Math People,
> 
> I'm new to Mathematica so please bear with me.
> 
> I have a simple problem I want to solve and I'm looking
> for some ideas to get started on it.
> 
> I want to simulate 100 tosses of a crooked coin where
> probability of Heads is 0.6 and Tails is 0.4.
> 
> After I figure the coin out, I want to move on to crooked
> dice and crooked card decks.
> 
> So, really what I'm looking for has more to do with developing
> a method to simulate the collection of random samples.
> 
> I looked around in Help and found a promising sentence:
> 
> "Random[distribution] gives a random number with the specified
> statistical distribution."
> 
> Then I found a page here which has some clues:
> http://mathworld.wolfram.com/DiscreteDistribution.html
> 
> Unfortunately, I'm weak with math notation so the above
> page makes little sense to me.
> 
> So, let me put it to you as simply as I can:
> 
> I want to define a function that could be called like this:
> 
> numberOfHeads = coinTosser[infoAboutCoin, numberOfTosses, head]
> numberOfTails = coinTosser[infoAboutCoin, numberOfTosses, tail]
> 
> Once I figure out how to write the above function,
> I could template off of it to build something like this:
> 
> numberOfOnes = diceRoller[infoAboutThisDie, numberOfRolls, aOne]
> 
> Do any of you have thoughts on how to approach the
> writing of the above functions?
> 
> -Dan


  • Prev by Date: Re: How to simulate random samples from crooked coin toss?
  • Next by Date: Re: How to simulate random samples from crooked coin toss?
  • Previous by thread: Re: How to simulate random samples from crooked coin toss?
  • Next by thread: Any ideas about solving an underdetermined system?