Skip to main content

Posts

Showing posts from 2019

The Monty Hall Problem

The Monty Hall problem is a probabilistic puzzle that confounds lots of people including a Nobel laurate in physics apparently! The Monty Hall problem is based on a TV quiz show and is stated in this way: A player is presented with three doors and behind one of the doors is a prize. The aim of the game is for the player to select the door with the prize behind. Of course, the player does not know which of the doors the prize is behind.   The player guesses which of the three doors the prize is behind. At that point one of the doors which the prize is not behind and which has not been selected by the player is opened. So now there are two closed doors. The player is then asked whether they wish to stick with the door that they selected or switch to the other remaining closed door. Intuitively we think of the problem like this.   Originally there is a one in three chance of us selecting the correct door.   Then one of the doors is opened and then it appears the problem becomes a

Calculating Pi using Monte Carlo Simulations

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 circle

What is Computational Thinking?

Computational thinking is a nebulous concept that we can summarise as the ability to solve problems through the application of algorithms. The Raspberry Pi foundation consider computational thinking  to include logical thinking, decomposition, abstraction, pattern recognition, algorithm design, evaluation and organising data.  For the purposes of this article I will go with this interpretation. With the aid of concrete examples,  I will unpick each of these components in turn.   I will start with logical thinking because logic is integral to the other aspects of computational thinking. We are familiar with this way of thinking because m any puzzles and games of strategy such as chess, and solving Rubik's cube  require us to think logically.  To solve these types of problems we need to be able to think clearly and have sound reasoning.  Consider the following two statements: All computer science teachers eat cake No cake eaters cycle bicycles Based on these two statements is