News for hackers. Stuff that matters.
Re:Finding Pi from Random Numbers by hannasanarion on Thursday December 27, 2018 @09:55AM (#18769728)
This is a classic statistics/machine learning exercise. It is also the topic of my favorite scientific paper of all time:

https://arxiv.org/abs/1404.1499

> A Ballistic Monte Carlo Approximation of π

>>We compute a Monte Carlo approximation of π using importance sampling with shots coming out of a Mossberg 500 pump-action shotgun as the proposal distribution.

Re:Finding Pi from Random Numbers by xucheng on Thursday December 27, 2018 @10:41AM (#18770062)
There is another way to compute pi from random numbers while having nothing to do with geometry. The probability of two random numbers being co-prime is related to pi [1]. Notably, standupmaths did this once by hand [2].

[1]: https://en.wikipedia.org/wiki/Coprime_integers#Probability_o...

[2]: https://youtu.be/RZBhSi_PwHU

Re:Finding Pi from Random Numbers by liberte82 on Thursday December 27, 2018 @10:43AM (#18770084)
How do you do this with the need to use a ceiling? (Sorry, I didn't watch the video).
Re:Finding Pi from Random Numbers by hcs on Thursday December 27, 2018 @12:18PM (#18770848)
If you mean a highest integer, he didn't, he's using rolls of a pair of 100+ sided dice. It's an approximation, anyway.
Re:Finding Pi from Random Numbers by inlineint on Thursday December 27, 2018 @12:15PM (#18770819)
There is also the classical Buffon's needle experiment: https://en.wikipedia.org/wiki/Buffon%27s_needle#Estimating_%...
Re:Finding Pi from Random Numbers by nine_k on Thursday December 27, 2018 @02:30PM (#18771849)
The article is not about the (trivial) way to compute pi by putting random numbers in the square. It's about altering the way you compute your target function to narrow down the confidence intervals, while still computing the same value.

Definitely you can compute pi by scanning a uniform grid in a square and checking how much ends up in the quarter-circle. But with these stats tricks applied, mere 10k points give the author very good approximation, beating 22/7 30% of the time. Scanning a 100x100 grid will give a much coarser approximation, I suppose.

Re:Finding Pi from Random Numbers by liberte82 on Thursday December 27, 2018 @10:40AM (#18770051)
I had to do this exercise in my undergrad, it's always stuck out as one of the exercises I've remembered and found really interesting.