Naked Science Forum

On the Lighter Side => That CAN'T be true! => Topic started by: LeeE on 05/07/2009 13:06:41

Title: Is this the silliest way to calculate Pi?
Post 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]
Title: Is this the silliest way to calculate Pi?
Post by: Bored chemist on 05/07/2009 13:31:34
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.
Title: Is this the silliest way to calculate Pi?
Post by: Don_1 on 06/07/2009 10:35:40
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)
Title: Is this the silliest way to calculate Pi?
Post by: Chemistry4me on 06/07/2009 11:05:17
Maybe for you!
Title: Is this the silliest way to calculate Pi?
Post by: LeeE on 06/07/2009 15:25:52
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.
Title: Is this the silliest way to calculate Pi?
Post by: RD on 06/07/2009 20:36:44
... 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
Title: Is this the silliest way to calculate Pi?
Post by: lyner on 06/07/2009 23:23:43
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.
Title: Is this the silliest way to calculate Pi?
Post by: Bored chemist on 07/07/2009 15:03:11
... 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 π".
Title: Is this the silliest way to calculate Pi?
Post by: RD on 07/07/2009 20:56:06
"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  [:)]
Title: Is this the silliest way to calculate Pi?
Post by: LeeE on 07/07/2009 23:17:46
... 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.
Title: Is this the silliest way to calculate Pi?
Post by: Don_1 on 10/07/2009 07:59:08
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)
Title: Is this the silliest way to calculate Pi?
Post by: Chemistry4me on 10/07/2009 09:03:46
You mean Pi2?
Get rational.
Title: Is this the silliest way to calculate Pi?
Post by: Don_1 on 10/07/2009 09:26:54
I see you know your onions.
Title: Is this the silliest way to calculate Pi?
Post by: Chemistry4me on 10/07/2009 09:27:50
Are you for real?
Title: Is this the silliest way to calculate Pi?
Post by: Don_1 on 10/07/2009 09:39:24
I am a little old and crusty.
Title: Is this the silliest way to calculate Pi?
Post by: Chemistry4me on 10/07/2009 09:41:10
You want a Nobel Peas Pie?
Title: Is this the silliest way to calculate Pi?
Post by: Chemistry4me on 10/07/2009 09:45:38
Or some more PUN-kin-PI?
Title: Is this the silliest way to calculate Pi?
Post by: Don_1 on 10/07/2009 09:47:07
"Chef, why have you put toadstools in the steak pie?"

All together now!

"Because there wasn't mushroom."
Title: Is this the silliest way to calculate Pi?
Post by: Chemistry4me on 10/07/2009 09:54:01
No! Why did you have to a salt the pie puns?
Title: Is this the silliest way to calculate Pi?
Post by: Don_1 on 10/07/2009 09:59:01
I'm feeling a little 'Cobersty' at the moment, so I might look back over some past threads and cut & pastry them here.
Title: Is this the silliest way to calculate Pi?
Post by: Chemistry4me on 10/07/2009 10:01:44
That could be a bit tough eh? I never sausage a mess, so lettuce sleep on it then shall we?
Title: Is this the silliest way to calculate Pi?
Post by: Don_1 on 10/07/2009 11:47:27
OK, I won't just pastry them, I'll chop them up and steak them out for you to pig and choux from them.