Skip to content

Latest commit

 

History

History
46 lines (29 loc) · 2.62 KB

README.md

File metadata and controls

46 lines (29 loc) · 2.62 KB

funprojects

This will be the headquarters of future curious projects. Here I'll post the visualization of the final state of them.

Pi estimator

Months ago I found on internet a smart way to estimate pi using geometry. Whenever we see pi we have to think on circles, so the key is to elaborate a relationship between a circles' area or perimeter and other geometric figure.

"PI is the ratio of a circle's circumference to its diameter."

Imagine a circle inscribed in a square. The relationship between their areas is f1, so we can isolate pi as f2.

Here comes the clever idea:

  1. Imagine an inscribed circle into a square.
  2. Paint the whole figure with small points.
  3. Count the points that fell inside the circle. If the points cover the entire square, then the painted area equals the area of the square.
  4. Replace the counts of points inside each figure in the formula of pi and calculate the estimator.
  5. Expect error. This way of estimation doesn't scale well.

Birthday paradox

Let's imagine we enter a room with 30 unknown people (maybe a random university class). I'll tell you that at least two of them were born in the same day of the year. Would you bet against me? What about 40? I'm giving you 50 to 1 odds on 60 people! The truth is this is a mathematical scam and I'll explain it to you:

Assumptions:

  • All days are equally likely
  • No leap-year

Let n be the sample size (i.e. the number of people in a room) and p the probability of at least 2 people sharing birthday out of n people. Then, the probability of 2 people or more sharing birthday out of n is:

So, what is the probability of finding 2 persons that share birthday out of 20 or more people?