Saturday 16 June 2012

Pi equals 3.0226

Okay, it doesn't, but I just finally did an experiment that I read about years ago when doing a translation on Monte Carlo approximation.

You may know it, but still, it involves drawing a circle inside a square with sides equal to the circle's diameter. Then, by some random method, you put points on the circle-in-square and work out the ratio of points on the circle to points on the square, and thereby approximate pi.

Here are photos of my effort, in which I dropped grains of rice, and then (quite laboriously) counted them. I counted those outside first, then those inside. There were 227 grains outside of the circle, and 702 inside. This gave me 929 grains on the square and 702 on the circle. I had to make a judgement when they were on the line, but just went with the obvious choice of inside the circle if more of the grain is inside, and outside otherwise.

For what it's worth, the radius of the circle was 4", and so the sides of the square were 8". However, I treated them as being of unit length. Hence, the area of the square was 4 and the area of the circle was pi.
The ratio therefore was pi/4, and the ratio from the rice-approximation was 702/929, which to 5 d.p. is 0.75565. Times 4 and we get pi roughly equal to 3.0226.

It may not be that close (I was hoping for something that would round to 3.1 at least), but for what it's worth, if 28 of those that ended up in the square only had ended up in the circle, we'd have got (730/929) x 4 = 3.14316, which is pretty close.

In the hopes of getting a bit closer, I also checked the weights and got 14.85g for the square and 11.15g for the circle. This got me an approximation of pi (to 5 d.p.) of 3.00363. Oh hang on, I shouldn't be going to more decimal places than there are in the input values, should I? So actually, this just gets pi = 3. Oh well.

So there we have it. Another way of wasting time on a Saturday afternoon that should be spent studying. At least it's maths though.









3 comments:

  1. Somebody did a very similar experiment once, involving throwing sticks, and seeing how many landed inside the circle, and got 113/355 as the probability, which is very close to pi.

    I think he cheated....

    ReplyDelete
  2. Interesting
    I guess to get closer you would need 10,000 grains of rice.
    Something a computer could simulate but obviously you couldn't do by hand unless you were in a cell under solitary confinement.

    It would be interesting to see if you could work out some sort of relationship between the number of grains and the goodness of the approximation. Still need to finish off the Topology TMA before I get distracted

    Best wishes Chris

    ReplyDelete
  3. Thanks for the comments guys.

    It was a bit tempting to cheat here actually. Not so much by claiming useful results, but when I realised how long it was taking me to count up the rice, to kind of estimate how many there were. I'm glad I saw it through though, otherwise what would have been the point, and the fairly close result was vindication of the effort I think.

    It's certainly plausible that 10000, or even more, would get a pretty close approximation, but with my size of square/circle, I'd probably not fit many more than 10000, i.e. 10x the almost a thousand grains I ended up using. Beyond that it would start getting a bit crowded. I assume though, it wouldn't be a problem if they piled up, other than them covering up the line.

    Perhaps some kind of 3D set up, with a box for the square and cylinder for the circle, would work well. In fact, that gives me a nice idea for a rainwater-collecting experiment; we have so much of it these days, it would be good to put it to some use.

    Neil H

    ReplyDelete