PowerBASIC Forums
  Cafe PowerBASIC
  Dicing With Probability (Page 2)

Post New Topic  Post A Reply
profile | register | preferences | faq | search

UBBFriend: Email This Page to Someone!
This topic is 10 pages long:   1  2  3  4  5  6  7  8  9  10 
next newest topic | next oldest topic
Author Topic:   Dicing With Probability
Brad D Byrne
Member
posted January 20, 2007 11:53 PM     Click Here to See the Profile for Brad D Byrne     Edit/Delete Message   Reply w/Quote
David, from a math point I am very inclined to agree w/ ya

yet, hehe, I think our math must be a little incomplete, because,

"...we cannot know when that balance will occur..." true, well it should
be true, yet we do know that it is more accurate to say that it will
lean to balance in 1000 games, than to say it will continue at 50/50!

a dilemna I know

------------------
Washington DC Area
Borje's "Poff's" is likely the BEST tool for learning PB.. http://www.reonis.com/POFFS/index.htm
And a few PBTool's & Beginner Help:http://sweetheartgames.com/PBTools/JumpStart.html
& Another Good Resource: http://www.fredshack.com/docs/powerbasic.html

IP: Logged

David Roberts
Member
posted January 21, 2007 04:50 AM     Click Here to See the Profile for David Roberts     Edit/Delete Message   Reply w/Quote
There is no dilemma, Brad.

We have '50:50' on the first toss of a coin. On subsequent tosses the average will oscillate about '50:50'. As the number of tosses tends to infinity the average will tend to '50:50'. Finally, to use a mathematics term, 'in the limit' the average will be '50:50'. That is, at the point of infinity which, admittedly, is beyond imagination but used in the same way as a convergent series summation at the point of infinity determined without the need for an infinite number of steps.

In effect we have a vibrating string fixed at 1 and infinity with the vibrations increasingly dampened as we approach infinity.

Sounds like quantum mechanics.

Come to think of it we haven't got an average on the first toss. I may be able to scrape through by saying we have '50:50' whilst the coin is in the air spinning. On landing the probability density function collapses, à la Schrodinger's wave function collapsing, and we have either a head or a tail.

Added: I'm not out of the soup until the second lands. OK, during the second spin we have both 0.75 and 0.25 coexisting given that the first is a head or not; the average being 0.5. On collapsing we have either 1, 0 or two chances at 0.5; the average again being 0.5. Spooky, isn't it? I think I'll fix the string at zero whilst I'm at it giving exactly 50:50 at both ends. Of course, we could have 50:50 between but we'll never know a priori.

[This message has been edited by David Roberts (edited January 21, 2007).]

IP: Logged

Charles Pegge
Member
posted January 21, 2007 07:34 AM     Click Here to See the Profile for Charles Pegge     Edit/Delete Message   Reply w/Quote
Caution needed here.

While it is true that as you increase the number of flips, your average
will approach 50:50, but your chances of getting an exact 50:50 will go down.
That is a confusing paradox.

For instance:

probabilities of getting exactly equal heads and tails:


    2 flips 0.5
    4 flips 0.375
    6 flips 0.318
    8 flips 0.273
    10 flips 0.246

Your standard deviation from the mean only decreases by the square root of the number of flips.

------------------
www.pegge.net

IP: Logged

Brad D Byrne
Member
posted January 21, 2007 10:38 AM     Click Here to See the Profile for Brad D Byrne     Edit/Delete Message   Reply w/Quote
Cool!! David, Charles, this is getting Fun!!

wish we new the length of the string

need to go work right now, but looking forward to where this goes

B

------------------
Washington DC Area
Borje's "Poff's" is likely the BEST tool for learning PB.. http://www.reonis.com/POFFS/index.htm
And a few PBTool's & Beginner Help:http://sweetheartgames.com/PBTools/JumpStart.html
& Another Good Resource: http://www.fredshack.com/docs/powerbasic.html

IP: Logged

Michael Mattias
Member
posted January 21, 2007 12:27 PM     Click Here to See the Profile for Michael Mattias     Edit/Delete Message   Reply w/Quote
Simplified Rules of Probability For Dice Games: "Ya pays yer money and takes yer chances."

IP: Logged

David Roberts
Member
posted January 21, 2007 01:40 PM     Click Here to See the Profile for David Roberts     Edit/Delete Message   Reply w/Quote
quote:
wish we new the length of the string

We could map the number of tosses into the width of our monitor with 50:50 at the half height. Eventually the oscillations will be barely discernible and, as Charles points out, the likelihood of crossing the line will almost vanish leaving us with an asymptotic curve heading either north or south to the point of getting under our monitor resolution appearing then as a flat line ie visually fully dampened. To use Charles' word paradoxically we could have the difference between heads and tails in the billions but the relative value compared with unity may be infinitesimal.

This is typical of a determinate process where the outcome is known but the path to it is not as opposed to an indeterminate process such as a chaotic one where the path in small increments is almost known but the outcome, like whether it will be raining on the first Sunday in 2009, is not.

IP: Logged

Ian Cairns
Member
posted January 22, 2007 03:49 PM     Click Here to See the Profile for Ian Cairns     Edit/Delete Message   Reply w/Quote
Flipping coins with a computer is not the same as flipping coins in practice. We humans build bias into everything we do. I am sure that a practiced coin tosser could flip a coin a calculated number of turns and have it land (mostly but not always) with the desired side up.
regards, Ian Cairns

------------------
:) IRC :)

IP: Logged

Dave Stanton
Member
posted January 22, 2007 04:12 PM     Click Here to See the Profile for Dave Stanton     Edit/Delete Message   Reply w/Quote
quote:

I am sure that a practiced coin tosser could flip a coin a calculated number of turns and have it land (mostly but not always) with the desired side up.

Not and live long with both knee caps.

------------------
Dave
I know the answer, but not the question...

IP: Logged

Charles Pegge
Member
posted January 22, 2007 05:13 PM     Click Here to See the Profile for Charles Pegge     Edit/Delete Message   Reply w/Quote
Okay guys I give up. These were more tricky than
I originally anticipated, so I'll just get it over with.
Here are the answers:

Throwing a dice 5 times:

principle idea:
A=1/6 the odds of getting a ONE
B=1-A the odds of not getting a ONE
5 flips
(A+B)^5
expands to:
1*(A^5) + 5*(A^4*B) + 10*(A^3*B^2) + 10*(A^2+B^3) + 5*(A*B^4) + 1*(B^5)
representing different combinations of ONES and their probailities.


A: Getting 3 ONES in a row.

Possible combinations that satisfy:
{111XX} {X111X} {XX111}
{1111X} {X1111}
{11111}
translates to:

3*(1/6)^3*(5/6)^2 +
2*(1/6)^4*(5/6) +
1*(1/6)^5

.011

B: getting a ONE 3 times only.

10*(1/6)^3*(5/6)^2
.032

C. getting a ONE 3 times or more.

1*(1/6)^5 + 5*(1/6)^4*(5/6) + 10*(1/6)^3*(5/6)^2
.0013 + .0032 + .0322
.037

D. getting a single ONE, a single TWO and a single THREE in any order.
notice how (5/6)^2 is replaced by (3/6)^2 because 3 numbers are involved.

10*(3/6)*(2/6)*(1/6)*(3/6)^2
.070

E. getting a single ONE, a single TWO and a single THREE in ascending order.

10*(1/6)*(1/6)*(1/6)*(3/6)^2
.012

May your kneecaps live long.

------------------
www.pegge.net

IP: Logged

Ian Cairns
Member
posted January 22, 2007 06:14 PM     Click Here to See the Profile for Ian Cairns     Edit/Delete Message   Reply w/Quote
Whenever you are dealing with anything that a human being can influence (even if you think they can't), especially if the outcome will cost you something, be suspicious.
Memorable Quotes from Guys and Dolls (1955) by Sky Masterson (Marlon Brando)
quote:
One of these days in your travels, a guy is going to show you a brand-new deck of cards on which the seal is not yet broken. Then this guy is going to offer to bet you that he can make the jack of spades jump out of this brand-new deck of cards and squirt cider in your ear. But, son, do not accept this bet, because as sure as you stand there, you're going to wind up with an ear full of cider.

source: http://us.imdb.com/title/tt0048140/quotes
regards, Ian Cairns

------------------
:) IRC :)

IP: Logged

Donald Darden
Member
posted January 23, 2007 01:10 AM     Click Here to See the Profile for Donald Darden     Edit/Delete Message   Reply w/Quote
Let;s look at coin flipping another way. Say that this is az coin
that all factors are balanced so that it truly should come up
either heads ot tails equally.

As you flip the coin, there will always be a tendancy for the
coin to flip one way more often than the other. That is, in the
short term, there will either be more heads than tails, or more
tails than heads, but the chances of exactly the same number of
heads and tails will be fairly small.

Since there is no memory associated with coin flipping, what is
the compelling reason that after 1,000, or 1 million throws, that
the number of heads and tails will drift back to an equal number
of each? The question means, if you drift to one side by say,
15 more heads than tails, aren't you presuming that within some
finite interval or sequence of throws that the drift will be at
least 15 more tails so as to reach a point where you would see
a balance of 50/50 in the outcome?

Probability says that the odds are exactly the same, but in actual
practice, there would be no point where you could predict that
the quantity of heads and tails would exactly match. And
the probability is much higher that there will either be more
heads, or more tails at any given time, than that the counts will
ever again be exactly the same. Further, if by chance the counts
ever do match again, this in no way influences the outcome of
further tosses, and your very next throw will ensure that you
will either have more heads or more tails, depending on which
way the coin lands, which would always be true for ever odd
toss of the coin.

------------------
Old Navy Chief, Systems Engineer, Systems Analyst, now semi-retired

IP: Logged

Brad D Byrne
Member
posted January 23, 2007 01:21 AM     Click Here to See the Profile for Brad D Byrne     Edit/Delete Message   Reply w/Quote
Yeah, but the pendulum does swing!

not to distract from the original topic too much and Charles' fine math!

Thanks! Charles

ADDED: and btw, your paintings are GREAT! Charles! http://www.pegge.net/paintings/PEGGE.HTM

------------------
Washington DC Area
Borje's "Poff's" is likely the BEST tool for learning PB.. http://www.reonis.com/POFFS/index.htm
And a few PBTool's & Beginner Help:http://sweetheartgames.com/PBTools/JumpStart.html
& Another Good Resource: http://www.fredshack.com/docs/powerbasic.html

[This message has been edited by Brad D Byrne (edited January 23, 2007).]

IP: Logged

Emil Menzel
Member
posted January 23, 2007 12:24 PM     Click Here to See the Profile for Emil Menzel     Edit/Delete Message   Reply w/Quote
>>Probability says that the odds are exactly the same, but in actual
practice, there would be no point where you could predict that
the quantity of heads and tails would exactly match.

I agree, as would (I believe) any statistician. To elaborate:
If you were to flip a coin a million times I would bet almost
anything that you were NOT going to get exactly the same number of
heads and tails. Even if you were to repeat this exercise 10,000
times I'd bet that the average number of heads (i.e., total head
over all 10,000 runs, divided by 10,000) would still not be
exactly .5000000000000.

Of course I might possibly lose my bet -- especially (say) if we
do the test on a PC using a plain vanilla RND function, and you
feed it the right seed number. (And it is not hard to find such
seed numbers.)

The probabilities that Charles is talking about are exact, but
at the level of theoretical math and not empirics.

More could be said on this score, both mathematically &
philosophically, but I'm not sure that it is relevant to the main
topic.

Another thing I have found with computer simulations is that if
you plot a graph with total heads/(total heads + total tails) on
the Y axis and "total number of tosses, so far" on the X axis, one
can get some very interesting trends over time, and some can very
definitely be non-random. Of course, whether the trend will go
up or down is by no means entirely predictable -- unless, again,
one knows, or loads, the seed number.

------------------

IP: Logged

Emil Menzel
Member
posted January 23, 2007 12:49 PM     Click Here to See the Profile for Emil Menzel     Edit/Delete Message   Reply w/Quote
Another puzzle:

What is the probability of getting exactly 50% heads & 50% tails if
the total number of coin-tosses (N) is 10, 100, 1000... ?
What does the trend look like?

------------------

IP: Logged

David Roberts
Member
posted January 23, 2007 02:31 PM     Click Here to See the Profile for David Roberts     Edit/Delete Message   Reply w/Quote
The question can be put: What is the probability of N/2-combinations from N.

The number of r-combinations from n is given by nCr = n!/(r!(n-r)!)

So, the number of N/2-combinations from N is given by N!/((N/2)!^2)

The population is simply the summation of the coefficients of Pascal's pyramid ( see Charles' first post) which is 2^N

So, the answer to Emil's question is N!/((N/2)!^2/(2^N))

As N tends to infinity this probability tends to zero confirming Charles' cautionary note earlier.

Added: The trend will be inverse exponential.

Added further: The humdinger of a paradox is that as N tends to infinity the ratio of heads vs tails tends to 50:50 with a probability tending to zero.

In other words the theoretical expected value ain't going to happen. Unfortunately this is what can happen when dealing with infinity in a domain where it can never be realised. The paradox is very 'quantum'. Infinity, entities that vanish and return and generally anything that goes bump in the night are common place in the quantum domain.

A bit more: An analogy would be a glass half full of beer. We then half fill the empty part. We then half fill the new empty part. The theoretical limit is a full glass but we never get there because we keep dividing the empty part. In practice we hit the Planck length when the empty part is smaller than anything which is not space so we either leave it as falling short or overflow. Such is life.

[This message has been edited by David Roberts (edited January 23, 2007).]

IP: Logged


This topic is 10 pages long:   1  2  3  4  5  6  7  8  9  10 

All times are EasternTime (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply
Hop to:

Contact Us | PowerBASIC BASIC Compilers

Copyright © 1999-2007 PowerBASIC, Inc. All Rights Reserved.


Ultimate Bulletin Board 5.45c