Happy Pi Day! + 3.14 Steem contest

@neavvy · 2019-03-14 15:24 · busy

Introduction

March 14. What does this date mean to every tech geek in the world? Well, you guessed, today we are celebrating probably the most iconic and popular number - Pi. But why this particular day? March 14 in the month/day format is 3/14, the same as the first three digits of Pi.

Pi visualization

In order to honor this number properly, I decided to uncover its hidden beauty. Firstly, I have chosen a circle as a base of my visualization, as Pi is significantly associated with this geometric shape. I divided this circle into ten fractions, each of them representing one digit.

After that, I wrote a computer program that takes the first digit of Pi and draws a line to the second. Then, it draws a line from the second to the third, from the third to the fourth etc. That's the result (I took the liberty of adding some fancy colors):

vis.png

A little contest

Make a guess how many digits of Pi are visualized in the image above. A person with the most accurate guess will get 3.14 Steem! Your comment must be submitted before this post pays out. After that, I will select a winner and transfer Steem. Results will be posted in the comment under this post. Upvote and resteem are not obligatory, but highly appreciated!

Pi approximation

Humanity had many attempts to approximate Pi as precisely as possible. One of them was a fraction 22/7, which in decimal representation equals to 3.14285714. Compared to the today's Pi (3.14159265) this result is really admirable.

Apropos today celebration, I would like to try to find another approximation using Monte Carlo method. Firstly, I created a square with an inscribed circle.

circle.png

In this situation: CodeCogsEqn (7).gif CodeCogsEqn (8).gif CodeCogsEqn (9).gif

If we could calculate the ratio between the area of circle and the area of square, we would be able to approximate Pi using this simple equation. One method to find this ratio is generating a big number of randomly located points and checking if they are within the area of circle or not.

points.png

Once we know the number of points:

CodeCogsEqn (10).gif

The best approximation I managed to get using this method:

3.14159292 - my approximation
3.14159265 - real Pi

As you can see this result is pretty satisfying, as the difference begins on the seventh decimal place.

Thank you for reading and wish you good luck in the contest!

#steemstem #science #technology #contest #education
Payout: 0.000 HBD
Votes: 387
More interactions (upvote, reblog, reply) coming soon.