Estimating Pi with a dart board (and python!)

Task 1 – Warm up

To see how to draw circles, plot points and pick random numbers have a look at this code and adapt it to draw a face:

Task 2

Find the area of the square below

Find the area of the circle

Find the answer to  (4 x area of circle / area of square)

Task 3

Adapt the app below to estimate pi. You are aiming for this:

Note that the formula for a circle is x**2+y**2=r**2

where ** on python is squared.

Cereal box problem revisted

Suppose there was one of six toy animals inside your favorite box of cereal and you would like to collect them all.

You could be lucky and only buy six boxes, but how many boxes of cereal would you expect to have to buy on average?

With thanks to this website we carried out an experiment with dice to simulate this problem. We rolled a dice until we had thrown all the numbers 1 to 6 and recorded how many rolls it took.

Click here for a pdf with several blank tables to cut out and use.

We then used python to generate 1000 trials and compared our average to the theoretical average we calculated. Can you try and program this in the trinket below?

Or, for very advanced mathematicians, you could try and find the theoretical probability. Worksheet here.

Solution in python is here, and the theoretical probability can be found in this article.