**Monte Carlo technique**

[IMP.: Along with the plots I also want to see the programs you used]

1. Compute the value of pi using Monte Carlo technique.

Consider the square region [0,2]x[0,2]. Now generate pairs of random
numbers corresponding to x & y coordinates of randomly chosen points
within the square region (the *rand* function of MATLAB generates
uniformly distributed random numbers in the interval [0,1] - so multiply
by 2, to get random numbers in the interval [0,2]). Check to see if they
fall in the circle centered at (1,1) and with a radius of 1. If, out of
N generated random points, M points fall within the circle, the ratio
M/N is the ratio of the area of the circle to the area of the square. Hence
compute the value of pi.

For each N, compute pi at least 10 times and find the standard
deviation and mean (use MATLABs *mean* and *std* functions).

Plot how the mean and standard deviation of the computed value of pi
changes as N is increased (use N=100, 250, 500 ,750, 1000, 2000, 5000,
10000, 50000 and 100000). (You can use MATLABs *errorbar* function
to plot the mean and standard deviation of the data points)

2. Determination of random packing fraction of circles.

Bernal was probably the first one to try to obtain the random packing
fraction of spheres by using monte carlo simulation. In his Bakerian lecture
(1962), Bernal says "I was able to produce ... a model with spheres derived
from the simple process of choosing the coordinates of a succession of
points strictly at random and keeping all of them that were not less than
a certain distance from points already chosen." (p. 305)

Implement this method in two dimensions. Choose a square (having sides
of length 10 units, say). Now try packing circles with radius of 0.5 units.
Choose random points in the square and check whether they are at least
2 radii away from the centre of a previously chosen circle or at least
1 radii away from the boundaries. If they are then accept this as the coordinate
of a new circle. Proceed in this manner until you find that after many
iterations you cannot find the coordinate of a new circle. Plot how many
iterations are needed before each new circle is accepted. Choose a judicious
cut-off value of the iteration number based on this data. Compute the packing
fraction.

Keeping the radius of the circle constant, increase the size of the square box (from 10 units go upto 1000 units in 5 steps). At each step compute the packing fraction. Try to also obtain the standard deviation for the smaller sized squares. Plot the mean and standard deviations of the packing fraction.

Note that Bernal says "This method became more amd more tedious and wasteful towards the end of the process and often as many as a thousand points had to be chosen for one to be accepted". So be patient ! :-)