# The Naked Scientists Forum

### Author Topic: Is this the silliest way to calculate Pi?  (Read 8357 times)

#### LeeE

• Neilep Level Member
• Posts: 3382
##### Is this the silliest way to calculate Pi?
« 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

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

#### Bored chemist

• Neilep Level Member
• Posts: 8667
• Thanked: 42 times
##### Is this the silliest way to calculate Pi?
« Reply #1 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.

#### Don_1

• Neilep Level Member
• Posts: 6890
• Thanked: 7 times
• A stupid comment for every occasion.
##### Is this the silliest way to calculate Pi?
« Reply #2 on: 06/07/2009 10:35:40 »
The easiest way to calculate pi, is to look at the cooking instructions on the back.

#### Chemistry4me

• Neilep Level Member
• Posts: 7709
##### Is this the silliest way to calculate Pi?
« Reply #3 on: 06/07/2009 11:05:17 »
Maybe for you!

#### LeeE

• Neilep Level Member
• Posts: 3382
##### Is this the silliest way to calculate Pi?
« Reply #4 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.

#### RD

• Neilep Level Member
• Posts: 8132
• Thanked: 53 times
##### Is this the silliest way to calculate Pi?
« Reply #5 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
« Last Edit: 06/07/2009 20:39:49 by RD »

#### lyner

• Guest
##### Is this the silliest way to calculate Pi?
« Reply #6 on: 06/07/2009 23:23:43 »
The easiest way to calculate pi, is to look at the cooking instructions on the back.

I think that would be 2pi, if it's a circular pie. Just to add confusion.

#### Bored chemist

• Neilep Level Member
• Posts: 8667
• Thanked: 42 times
##### Is this the silliest way to calculate Pi?
« Reply #7 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 π".

#### RD

• Neilep Level Member
• Posts: 8132
• Thanked: 53 times
##### Is this the silliest way to calculate Pi?
« Reply #8 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
« Last Edit: 07/07/2009 20:59:37 by RD »

#### LeeE

• Neilep Level Member
• Posts: 3382
##### Is this the silliest way to calculate Pi?
« Reply #9 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.

#### Don_1

• Neilep Level Member
• Posts: 6890
• Thanked: 7 times
• A stupid comment for every occasion.
##### Is this the silliest way to calculate Pi?
« Reply #10 on: 10/07/2009 07:59:08 »
The easiest way to calculate pi, is to look at the cooking instructions on the back.

I think that would be 2pi, if it's a circular pie. Just to add confusion.

You mean Pi2?

#### Chemistry4me

• Neilep Level Member
• Posts: 7709
##### Is this the silliest way to calculate Pi?
« Reply #11 on: 10/07/2009 09:03:46 »

#### Don_1

• Neilep Level Member
• Posts: 6890
• Thanked: 7 times
• A stupid comment for every occasion.
##### Is this the silliest way to calculate Pi?
« Reply #12 on: 10/07/2009 09:26:54 »
I see you know your onions.

#### Chemistry4me

• Neilep Level Member
• Posts: 7709
##### Is this the silliest way to calculate Pi?
« Reply #13 on: 10/07/2009 09:27:50 »
Are you for real?

#### Don_1

• Neilep Level Member
• Posts: 6890
• Thanked: 7 times
• A stupid comment for every occasion.
##### Is this the silliest way to calculate Pi?
« Reply #14 on: 10/07/2009 09:39:24 »
I am a little old and crusty.

#### Chemistry4me

• Neilep Level Member
• Posts: 7709
##### Is this the silliest way to calculate Pi?
« Reply #15 on: 10/07/2009 09:41:10 »
You want a Nobel Peas Pie?

#### Chemistry4me

• Neilep Level Member
• Posts: 7709
##### Is this the silliest way to calculate Pi?
« Reply #16 on: 10/07/2009 09:45:38 »
Or some more PUN-kin-PI?

#### Don_1

• Neilep Level Member
• Posts: 6890
• Thanked: 7 times
• A stupid comment for every occasion.
##### Is this the silliest way to calculate Pi?
« Reply #17 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."

#### Chemistry4me

• Neilep Level Member
• Posts: 7709
##### Is this the silliest way to calculate Pi?
« Reply #18 on: 10/07/2009 09:54:01 »
No! Why did you have to a salt the pie puns?

#### Don_1

• Neilep Level Member
• Posts: 6890
• Thanked: 7 times
• A stupid comment for every occasion.
##### Is this the silliest way to calculate Pi?
« Reply #19 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.

#### Chemistry4me

• Neilep Level Member
• Posts: 7709
##### Is this the silliest way to calculate Pi?
« Reply #20 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?

#### Don_1

• Neilep Level Member
• Posts: 6890
• Thanked: 7 times
• A stupid comment for every occasion.
##### Is this the silliest way to calculate Pi?
« Reply #21 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.

#### The Naked Scientists Forum

##### Is this the silliest way to calculate Pi?
« Reply #21 on: 10/07/2009 11:47:27 »