C2 Mathematical experiment - Buffon's Needle

  • 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!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • <img src="smileys/smiley11.gif" border="0" align="middle" /> Getting 404 error.

  • 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.

  • 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?

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

    The best explanation I have seen is

    Subscribe to Construct videos now
  • 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!?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)