Naked Science Forum
On the Lighter Side => That CAN'T be true! => Topic started by: LeeE on 05/07/2009 13:06:41
-
I once mentioned in an old and long forgotten thread that Pi could be calculated using random numbers, and I've finally got around to coding something to try it out[;D]
Basically, you generate pairs of random x & y coordinates then use Pythagorus to see if the coordinate falls inside or outside a circle (I actually got it wrong in the earlier thread - it's the number of points that fall inside the circle divided by the total number of iterations, and not the number that fall outside the circle, as I'd said earlier. To simply things I just used a quarter circle so I could just use values 0 < n < 1 and then multiplied the result by 4)
Anyway, after four runs of 10,000,000 iterations I got these results:
3.14275271428
3.14078311408
3.14159111416
3.14055391406
which gives a mean average of 3.141420214145.
Pretty poor results for the number of iterations, I think [;D]
-
No, the silliest way to calculate pi is by dropping matches on a striped floor. If the width of the stripes is that same as the length of the matches then the probalility of a match landing entirely in one stripe (rather than crossing the line between two stripes) is related to pi, but I can't remember the relationship. Come to think of it, it might have been a tiled floor.
-
The easiest way to calculate pi, is to look at the cooking instructions on the back.
(https://www.thenakedscientists.com/forum/proxy.php?request=http%3A%2F%2Fwww.mysupermarket.co.uk%2FImages%2FExternalImages%2FProductsDetailed%2F86%2F004486.jpg&hash=cb3ad763d7426114498384a113448e13)
-
Maybe for you!
-
No, the silliest way to calculate pi is by dropping matches on a striped floor. If the width of the stripes is that same as the length of the matches then the probalility of a match landing entirely in one stripe (rather than crossing the line between two stripes) is related to pi, but I can't remember the relationship. Come to think of it, it might have been a tiled floor.
Sounds interesting - I'll have to have a think about it.
-
... Come to think of it, it might have been a tiled floor.
You were right first time: it's stripes ... http://en.wikipedia.org/wiki/Buffon%27s_needle
-
The easiest way to calculate pi, is to look at the cooking instructions on the back.
(https://www.thenakedscientists.com/forum/proxy.php?request=http%3A%2F%2Fwww.mysupermarket.co.uk%2FImages%2FExternalImages%2FProductsDetailed%2F86%2F004486.jpg&hash=cb3ad763d7426114498384a113448e13)
I think that would be 2pi, if it's a circular pie. Just to add confusion.
-
... Come to think of it, it might have been a tiled floor.
You were right first time: it's stripes ... http://en.wikipedia.org/wiki/Buffon%27s_needle
Thanks.
I knew about the mathematical result. I didn't know that anyone had been daft enough to try it
"Mario Lazzarini, an Italian mathematician, performed the Buffon's needle experiment in 1901. Tossing a needle 3408 times, he attained the well-known estimate 355/113 for π".
-
"Mario Lazzarini, an Italian mathematician, performed the Buffon's needle experiment in 1901.
Tossing a needle 3408 times, he attained the well-known estimate 355/113 for π".
What a prodigious tosser [:)]
-
... Come to think of it, it might have been a tiled floor.
You were right first time: it's stripes ... http://en.wikipedia.org/wiki/Buffon%27s_needle
Ta for the link. Although it seems sillier on first hearing it's actually a much more efficient method than one I was trying, so I think the random x/y coordinate pairs system is still the silliest.
-
The easiest way to calculate pi, is to look at the cooking instructions on the back.
(https://www.thenakedscientists.com/forum/proxy.php?request=http%3A%2F%2Fwww.mysupermarket.co.uk%2FImages%2FExternalImages%2FProductsDetailed%2F86%2F004486.jpg&hash=cb3ad763d7426114498384a113448e13)
I think that would be 2pi, if it's a circular pie. Just to add confusion.
You mean Pi2?
(https://www.thenakedscientists.com/forum/proxy.php?request=http%3A%2F%2Flondoneater.com%2Fwp-content%2Fuploads%2F2009%2F01%2Fsquarepie-258.jpg&hash=c822e7b16d71c60d0e6b0d39a98bd14c)
-
You mean Pi2?
Get rational.
-
I see you know your onions.
-
Are you for real?
-
I am a little old and crusty.
-
You want a Nobel Peas Pie?
-
Or some more PUN-kin-PI?
-
"Chef, why have you put toadstools in the steak pie?"
All together now!
"Because there wasn't mushroom."
-
No! Why did you have to a salt the pie puns?
-
I'm feeling a little 'Cobersty' at the moment, so I might look back over some past threads and cut & pastry them here.
-
That could be a bit tough eh? I never sausage a mess, so lettuce sleep on it then shall we?
-
OK, I won't just pastry them, I'll chop them up and steak them out for you to pig and choux from them.