We can use millions of random numbers to calculate Pi. This is the Monte Carlo simulation approach and is so called because it refers to the randomness inherent in casinos for which Monte Carlo is famous. This is a neat little trick and is great exercise for A level students. We start off with a quarter circle with a radius of 1 unit. We then draw a square with an area of 1 by 1 unit that encompasses the quarter circle. We know that the area of a circle, a is Pi * r * r . Given that r=1 in this case, then a is the same as Pi . Millions of points from randomly selected pairs of x and y coordinates within the square are selected. Using Pythagoras where the magnitude of a point is given by sqrt(x*x + y*y) we can determine whether a point falls inside our outside the perimeter of the circle. The radius of the circle is 1 so if the point has a magnitude of less than 1 we know that it lies within the circle. Based on the proportion of points that fall within the perimeter of the ci...
Dscussion of topics related to teaching computer science in a secondary school.