Skip to content

Commit 9bcb520

Browse files
authored
readme
1 parent 5190414 commit 9bcb520

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# MonteCarlo
2+
By generating many random values, you can estimate the result of complicated mathematical equations via a
3+
technique known as the Monte Carlo method. You can estimate the value of π using a Monte-Carlo method.
4+
5+
Envision a unit circle (radius = 1).
6+
Specifically, we will work with the top right quadrant where all valid points are between { x = 0, y = 0 } and { x = 1, y = 1 }.
7+
By randomly generating many x, y pairs and calculating the length of the hypotenuse of a triangle
8+
with sides of length x, y using the Pythagorean theorem, hypotenuse=√(x^2+y^2 ),
9+
you can classify the pairs into those that overlap the unit circle (hypotenuse<= 1, blue shaded area)
10+
and those that fall outside the unit circle (hypotenuse>1, red shaded area).
11+
12+
The ratio of pairs that overlap the unit circle divided by the total number of pairs generated
13+
is the area of the unit circle in the top right quadrant.

0 commit comments

Comments
 (0)