 Funny math challenge | Sololearn: Learn to code for FREE!

+6

# Funny math challenge

You know that the surface of a disk of radius 1 is S=PI. This means that if if pick random dot in a 2x2 square the probability of being in the disk of radius 1 equals P=Pi/4. Use this to make a programm approximating PI by taking many random dots (lets say 10.000) and displaying your approximation of Pi

+2

For a Monte Carlo problem also nice to calculate the uncertainty. Code gives one sigma uncertainty, so double if you want to get the 95% uncertainty. https://code.sololearn.com/co1MzdEYfkFF/?ref=app

+11

Aaahh... the MonteCarlo method :) Amazingly enough, this is really *weak* (slow convergence) algorithm when compared to other numerical ones. But it might be the easiest to comprehend and teach :) https://code.sololearn.com/czBAt7x8pBAm/?ref=app

+5

Interesting, this reminds me the Buffon's needle.

+5

This is my code in Python! 🐍 Try it! https://code.sololearn.com/c3qXiw8NEykL/?ref=app

+4

https://code.sololearn.com/cLeD10pYa1cF/?ref=app

+3

One of my school's python missions was to show that visually (searches for the code) But nevermind it used the turtle graphics module

+1

Nice ones. A bonus if you can display the range for the value of pi with 95% of chances based on how many random launches you are doing (you will need some google)

-1

You are the best on this one my friend !