- 3,551
- 9,896
A nice experiment to not only find a method to estimate ##\pi## but also to demonstrate how difficult pure randomness can be difficult to achieve:
This discussion focuses on estimating the value of π using a Monte Carlo method involving random number generation. Participants describe generating pairs of random numbers (x, y) within the interval [0, 1] and determining if they fall within a quarter circle defined by the equation x² + y² ≤ 1. The accuracy of π estimation improves with the number of points generated, with one contributor noting that 64 million pairs yielded an approximation of 3.14165 using C and assembly language with AVX-512 extensions. The conversation also touches on the challenges of achieving true randomness in pseudo-random number generators, specifically referencing Microsoft's Visual Studio RNG and historical issues with the RANDU function.
PREREQUISITESMathematicians, computer scientists, software developers, and anyone interested in numerical methods and performance optimization in programming.
You can do that on a regular PC/laptop keyboard as well, you just have to set the keyboard language to Greek.PeroK said:My preferred method is to hit the buttons on my calculator at random and eventually hit the ##\pi## button.
I used the RNG implemented in Microsoft's Visual Studio. Here's what the docs say about that API:jedishrfu said:Would you happen to know how good the random number generator is?
https://learn.microsoft.com/en-us/dotnet/fundamentals/runtime-libraries/system-random said:Pseudo-random numbers are chosen with equal probability from a finite set of numbers. The chosen numbers are not completely random because a mathematical algorithm is used to select them, but they are sufficiently random for practical purposes. The implementation of the Random class is based on a modified version of Donald E. Knuth's subtractive random number generator algorithm. For more information, see D. E. Knuth. The Art of Computer Programming, Volume 2: Seminumerical Algorithms. Addison-Wesley, Reading, MA, third edition, 1997.
I hadn't heard this but would be surprised to find that it's still true.jedishrfu said:Years ago, a friend/mentor at work explained the difficulties of creating pseudo-random number generators in code. In one case, when sequential triplets of random numbers are plotted, they all lie on a plane in three-space.
I don't see that there is any parallel between the technique described in this thread and the Double Slit Experiment, other than the randomness of something being fired at a target.bdrobin519 said:But how would an experiment such as calculating points falling around a target randomly to calculate Pi correspond or (obviously) differentiate between the Double Slit Experiment?
Both experiments require a single projectile aimed at a target.
I seem to recall reading this was a weakness of the random number generator built into APL.jedishrfu said:Years ago, a friend/mentor at work explained the difficulties of creating pseudo-random number generators in code. In one case, when sequential triplets of random numbers are plotted, they all lie on a plane in three-space.
robphy said:To try out the new PF feature...
(updated)
- on line 2, click ##Z_{next}## to advance N by 10
- to have it run automatically, click the ticker to the left of "Run ##Z_{next}## on the top line
- Desmos has a limit of 10000 entries for a list... unless one hacks it (https://gist.github.com/jared-hughes godmode on pg2... i haven't tried it)
- it's not perfect--more of a proof of concept.
One would probably want to control the seed (in darts)
www.desmos.com/calculator/pzwjfyyddl
In the darts folder, the second argument of the random functions sets the seed. As written, the seeds are always in the same sequence.jack action said:So I tried this on PF and then again on demos; I got the same results! Is it really random? And if the results are somehow stored, why does it take so long to show the final results?
n = 100000000;4. BinCounts[Norm /@ RandomReal[1, {n, 2}], {0, 2, 1}][[1]]/n