File tree Expand file tree Collapse file tree 3 files changed +6
-1
lines changed
Expand file tree Collapse file tree 3 files changed +6
-1
lines changed Original file line number Diff line number Diff line change 1+ os : linux
2+ dist : bionic
13language : python
24python : 3.8
35cache : pip
Original file line number Diff line number Diff line change 321321 * [ Newton Raphson] ( https://github.com/TheAlgorithms/Python/blob/master/maths/newton_raphson.py )
322322 * [ Numerical Integration] ( https://github.com/TheAlgorithms/Python/blob/master/maths/numerical_integration.py )
323323 * [ Perfect Square] ( https://github.com/TheAlgorithms/Python/blob/master/maths/perfect_square.py )
324+ * [ Pi Monte Carlo Estimation] ( https://github.com/TheAlgorithms/Python/blob/master/maths/pi_monte_carlo_estimation.py )
324325 * [ Polynomial Evaluation] ( https://github.com/TheAlgorithms/Python/blob/master/maths/polynomial_evaluation.py )
325326 * [ Prime Check] ( https://github.com/TheAlgorithms/Python/blob/master/maths/prime_check.py )
326327 * [ Prime Factors] ( https://github.com/TheAlgorithms/Python/blob/master/maths/prime_factors.py )
Original file line number Diff line number Diff line change @@ -18,7 +18,8 @@ def random_unit_square(cls):
1818 """
1919 Generates a point randomly drawn from the unit square [0, 1) x [0, 1).
2020 """
21- return cls (x = random .random (), y = random .random ())
21+ return cls (x = random .random (), y = random .random ())
22+
2223
2324def estimate_pi (number_of_simulations : int ) -> float :
2425 """
@@ -56,6 +57,7 @@ def estimate_pi(number_of_simulations: int) -> float:
5657
5758 # doctest.testmod()
5859 from math import pi
60+
5961 prompt = "Please enter the desired number of Monte Carlo simulations: "
6062 my_pi = estimate_pi (int (input (prompt ).strip ()))
6163 print (f"An estimate of PI is { my_pi } with an error of { abs (my_pi - pi )} " )
You can’t perform that action at this time.
0 commit comments