[challenge] estimate Pi with Monte Carlo Method � 🎰� 🎰� 🎰� 🎰 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 13

[challenge] estimate Pi with Monte Carlo Method � 🎰� 🎰� 🎰� 🎰

Given a circle with radius r and middlepoint x,y Given a square wiht length 2r and same middlepoint as circle The area of the circle is r^2 * PI The area of the square is 4r^2 Hence the ratio area of circle / area of square is Pi/4 How to program that? Randomly create about 20000 points within the square. How many of them are points inside the circle? Figure the ration mentioned above and multiply with 4. It should be about PI Hint: a point is in the circle, if the distance to middlepo

7th Dec 2017, 4:10 PM
Oma Falk
Oma Falk - avatar
9 Answers
7th Dec 2017, 2:34 PM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 11
This reminds me the awesome animation by Calvin: https://code.sololearn.com/WHOsWK01C9yY/?ref=app
7th Dec 2017, 3:15 PM
Zephyr Koo
Zephyr Koo - avatar
7th Dec 2017, 3:12 PM
Oma Falk
Oma Falk - avatar
+ 6
https://code.sololearn.com/WyALDISxigXf/?ref=app
11th Mar 2018, 3:08 AM
Morpheus
Morpheus - avatar
7th Dec 2017, 3:27 PM
#RahulVerma
#RahulVerma - avatar
7th Dec 2017, 6:20 PM
yuri
+ 3
https://code.sololearn.com/WTGcnhKhE8W4/?ref=app
9th Dec 2017, 9:57 PM
Вадим Сухотин (Vadim Sukhotin)
Вадим Сухотин (Vadim Sukhotin) - avatar
15th Mar 2018, 10:47 AM
Baraa AB
Baraa AB - avatar
0
hai
8th Dec 2017, 2:11 PM
Biju Mohanan