|
PowerBASIC Forums
![]() Cafe PowerBASIC
![]() Dicing With Probability (Page 4)
|
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 |
|
James Graham-Eagle Member |
What's really been discussed here is the Weak Law of Large Numbers ... in this context it says that, as you toss the coin more and more the probability that the average number of heads will deviate from 0.5 by more than any fixed amount (no matter how small) tends to zero. See http://mathworld.wolfram.com/WeakLawofLargeNumbers.html ------------------ IP: Logged |
|
David Roberts Member |
I cannot help thinking that this is stating the obvious. That is as the sample approaches the population then the sample mean approaches the population mean. What else would it do? [This message has been edited by David Roberts (edited January 26, 2007).] IP: Logged |
|
Emil Menzel Member |
I'd say that we have strayed into the domain of the Law of Large Numbers but that Charles' opening problem was the Binomial Theorem. The Wolfram web site on the Weak Law of Large Numbers also lists The Law of Truly Large Numbers: "With a large enough sample, any The Frivolous Theorem of Arithmetic: "Almost all natural numbers are None of the above, coincidentally, is a joke. But if we consider "50-50" to be a natural number 0.5..... it is Here's a quote from one theoretical physicist that I think relevant. ------------------ IP: Logged |
|
Emil Menzel Member |
[delete this post, please] [This message has been edited by Emil Menzel (edited January 26, 2007).] IP: Logged |
|
Charles Pegge Member |
Generating PI by tossing coins where p= probability of getting exactly 50:50 in n flips given n*pi/2 = ( ( (n/2)^2*2^n )/n! )^2 pi = ( ( (n/2)!^2*2^n ) / n! )^2*2/n Since the PC gags on large factorials very rapidly, this has to be turned into a Hint: use logs wherever you can! ------------------ IP: Logged |
|
David Roberts Member |
quote: Emil, you are a gentleman. I immediately broke out the garlic. The usage, however, was benign and I didn't suffer any after effects. IP: Logged |
|
David Roberts Member |
sqrt(2/(pi*n)) was put forward as a good approximation for large n. Equally, given a probability then the equation will give a good approximation to n. I wouldn't have thought it useful in anyway for estimating pi. There are other methods which would give more accurate results and tax the CPU very much less. IP: Logged |
|
Charles Pegge Member |
David, I agree, this is a most inefficient way of estimating pi, it was more of a philosophical quest. By the way, there are 2 G words in the article, are you still feeling alright? ------------------ IP: Logged |
|
David Roberts Member |
The first 'G' word was used with 'g' in lower case and used as an exclamation - they come in below the radar and are innocuous. ![]() IP: Logged |
|
Emil Menzel Member |
Charles: Neat formula! I have seen a dozen or more simulated coin-tossing routines on various web sites, but nothing like your formula. By all means push it farther. Efficiency is for business administrators, not scholars. Indeed, I once saw a web site that boasted the least efficient known formula for computing Pi. It would be interesting to know whether methods based on randomization could surpass that Holy Grail... As a once-famous philosopher once said, Yesterday's metaphysics is today's physics and tomorrow's common-sense.
------------------ IP: Logged |
|
James Graham-Eagle Member |
The formula given by Charles above is known as Wallis's Porduct and can be written in the delightful form ... 2 2 4 4 6 6 8 8 See http://mathworld.wolfram.com/WallisFormula.html ------------------ IP: Logged |
|
Emil Menzel Member |
In FUNCTION PiEst, change the line that reads X2=LOG(2^N) to X2=LOG(2)* N and you will be able to increase N to 10 million or more. Of course you might have to wait a few seconds to get your results. But the Stirling approximation for LogFactorial would speed things up. James: Formula 12 in the Wallis reference comes closest to BASIC language ------------------ [This message has been edited by Emil Menzel (edited January 27, 2007).] IP: Logged |
|
Charles Pegge Member |
Thanks Emil and James. This is a method I came up with last night. It follows Wallis's Product quite closely.
[result] I could call it Lazy-Fingers. ------------------ IP: Logged |
|
Brad D Byrne Member |
You guys are going to LOVE!! this!
also see, http://www.cs.uwaterloo.ca/journals/JIS/compass.html ------------------ IP: Logged |
|
James Graham-Eagle Member |
Emil, The formula I gave for the probability of a 50:50 split in terms ------------------ 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 |
![]() |
|
Copyright © 1999-2007 PowerBASIC, Inc. All Rights Reserved.