# C2 Mathematical experiment - Buffon's Needle

### » Sun Mar 10, 2013 2:40 am

I recently heard about an interesting mathematical experiment called Buffon's Needle.

Basically, it suggests that if you drop enough needles (or matchsticks) of length l on a wooden floor with planks of width 2l, you can take the ratio of total number of matchsticks dropped to the number of matchsticks that cross the crack. This ratio should eventually equal pi (3.14159265).

I thought I'd write a C2 program to simulate the proposition, and it worked pretty well.

EDIT: dropbox hyperlinks aren't working for some reason, so try copying and pasting these links.

Here's a demo.

Here's the capx.

If you let the calculation run for a little while, you should see the ratio value approach pi. For a variety of reasons it won't be perfect but it gets pretty darn close.

It's a very interesting proposition, and its solution goes into the depths of probability calculus.

So, there's your uncomfortable math truth for the day!sqiddster2013-03-10 02:58:19
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,455

### » Sun Mar 10, 2013 2:44 am

Getting 404 error.
B
70
S
19
G
140
Posts: 3,321
Reputation: 82,724

### » Sun Mar 10, 2013 2:44 am

@blackhornet, trying to fix, no idea why it's happening.

@blackhornet, fixed it partially.

Heh, apparently you can't link to a file with an apostrophe.sqiddster2013-03-10 02:58:53
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,455

### » Sun Mar 10, 2013 6:35 am

Wow really cool.

I went to Wikipedia in the hopes of finding out why it eventually equals pie and understood exactly 4 words on that page.

Could someone do a 'explain like I'm 5' on how this works?
B
24
S
4
G
1
Posts: 244
Reputation: 3,462

### » Sun Mar 10, 2013 12:35 pm

@boolean, unless you understand integral calculus it's very hard to explain.

The best explanation I have seen is here.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,455

### » Sun Mar 10, 2013 5:44 pm

Ha nice. Yeah pi turns up in silly places. I studied economics and there are some things it turns up in and you just think .. wait wtf does pi have to do with the economy!?
B
14
S
4
G
3
Posts: 38
Reputation: 3,741