Since it is day, I thought I would show a way to measure . The way I have in mind is known as Buffon’s needle. If you have a flat surface with parallel lines of uniform separation and drop needs of uniform length on it, the ratio between the total number needles dropped and the number of needles crossing a line will be a factor of .
The figure below shows the needles of length in blue, and the lines in black with separation . For each needle there are two important values: and . The value is the distance between the center of the needle and the nearest line. The value is the acute angle between the needle and the nearest line. The span of available values of is then , and the span of is .
A uniform probability densities are assumed for both and since there is no preferred direction or position for needles. So the probability densities are defined by:
, for , and elsewhere.
, for , and elsewhere.
A uniform probability density is shown in the figure below for , note that the area is 1.
For simplicity, we will only consider the case where the needles are shorter or the same length as the separation distance between the lines: .
So for needles crossing a line, the projected half-length of the needle perpendicular to the lines is greater than the distance between the center of the needle to the nearest line:
This is the upper bound that is then plugged into the probability integral, to get the probability of crossing a line:
For the simple case where :
After enough drops the ratio between the number of needles crossing a line and the total number of needles will resemble the probability:
Combining these two equations, we get ratio that can measure :
Doing this measurement in real life by dropping needles would make a mess, so I wrote a python code to it instead. Below is a graph showing this ratio as a function of needle drops (shown in black), is shown in red. You can see the black line approaches as the number of needles increases.
The probability density as a function of is shown below. It is not perfectly flat as in the ideal case. This is because in my code the uniform probability density is along the Cartesian axes () rather than along . (The parallel lines are separated along ). I did this to avoid measuring python’s in its trigonometric functions.
A uniform random number is assigned to the projected needle length along or with a range of 0 to 1. The length of a needle is forced to be 1 by using the Pythagorean theorem: or . There is a 0.5 probability that either or is assigned to the uniform random number. This approximates a uniform probability density in . It’s not perfect though.
If however, the uniform random number is assigned to only , the ratio doesn’t make it to , it stops around 2.6, and the probability density is far from uniform. See the figures below:
The code for these plots is shown below:
import os import sys import math import numpy import pylab import random CL = 0 NN = 0 PIa =  NNa =  PIc =  ANGLES =  for ii in range(10000): PPx = random.uniform(1.0,10.0) #1-10 A-end x position PPy = random.uniform(0.0,10.0) #1-10 A-end y position (lines) RRx = random.uniform(-1.0,1.0) #B-end x displacement RRy = numpy.sqrt(1.0 - RRx**2) #B-end y displacement if (random.uniform(0.0,1.0)&amp;amp;amp;amp;amp;gt;0.5): #balance probability density to make it more uniform in terms of acute angle SIGN = 1 if (random.uniform(0.0,1.0)&amp;amp;amp;amp;amp;gt;0.5): SIGN = -1 RRy = random.uniform(0.0,1.0) #B-end y displacement RRx = numpy.sqrt(1.0 - RRy**2)*SIGN #B-end x displacement QQx = PPx + RRx #B-end x position QQy = PPy + RRy #B-end y position QQyf = math.floor(QQy) PPyf = math.floor(PPy) NN = NN + 1 if (QQyf-PPyf &amp;amp;amp;amp;amp;gt; 0.0): #if crossing line CL = CL + 1 NNa.append(NN) PIc.append(math.pi) RAT = (1.0*CL)/(1.0*NN) if (CL==0): PIa.append(0) else: PIa.append(2.0/RAT) ANGLES.append(abs(math.atan(RRy/(RRx+0.0001)))/math.pi) print PIa[-1] pylab.figure(1) pylab.xlabel(&amp;amp;amp;amp;amp;quot;NT&amp;amp;amp;amp;amp;quot;) pylab.ylabel(&amp;amp;amp;amp;amp;quot;2 NT/NC&amp;amp;amp;amp;amp;quot;) pylab.plot(NNa,PIc,'r') pylab.plot(NNa,PIa,'k') pylab.savefig('BPI1q.png') pylab.figure(2) pylab.hist(ANGLES, bins=10) pylab.xlabel(&amp;amp;amp;amp;amp;quot;Acute angle in factors of pi&amp;amp;amp;amp;amp;quot;) pylab.ylabel(&amp;amp;amp;amp;amp;quot;Needles dropped&amp;amp;amp;amp;amp;quot;) pylab.savefig('BPI2q.png') pylab.show()