






"""simple docstring"""
from collections.abc import Callable
from math import pi, sqrt
from random import uniform
from statistics import mean





def 				lowercase__		(					lowerCamelCase       ):

				# A local function to see if a dot lands in the circle.
				def is_in_circle(lowerCamelCase,						lowerCamelCase       ) -> bool:
								_SCREAMING_SNAKE_CASE   :		Union[str, Any]       		=    sqrt((x**2) + (y**2)       )
								# Our circle has a radius of 1, so a distance
								# greater than 1 would land outside the circle.
								return distance_from_centre <= 1

				# The proportion of guesses that landed in the circle
				_SCREAMING_SNAKE_CASE   :		Union[str, Any]       		=    mean(
				    int(is_in_circle(uniform(-1.0,						1.0       ),						uniform(-1.0,						1.0       )       )       )
				    for _ in range(lowerCamelCase       )       )
				# The ratio of the area for circle to square is pi/4.
				_SCREAMING_SNAKE_CASE   :		List[str]       		=    proportion * 4
				print(f"""The estimated value of pi is {pi_estimate}"""       )
				print(f"""The numpy value of pi is {pi}"""       )
				print(f"""The total error is {abs(pi - pi_estimate       )}"""       )





def 				lowercase__		(					lowerCamelCase,						lowerCamelCase,						lowerCamelCase = 0.0,						lowerCamelCase = 1.0,						):
				return mean(
				    function_to_integrate(uniform(lowerCamelCase,						lowerCamelCase       )       ) for _ in range(lowerCamelCase       )       ) * (max_value - min_value)





def 				lowercase__		(					lowerCamelCase,						lowerCamelCase = 0.0,						lowerCamelCase = 1.0       ):

				def identity_function(lowerCamelCase       ) -> float:
								return x

				_SCREAMING_SNAKE_CASE   :		Any       		=    area_under_curve_estimator(
				    lowerCamelCase,						lowerCamelCase,						lowerCamelCase,						lowerCamelCase       )
				_SCREAMING_SNAKE_CASE   :		Union[str, Any]       		=    (max_value * max_value - min_value * min_value) / 2

				print('******************'       )
				print(f"""Estimating area under y=x where x varies from {min_value} to {max_value}"""       )
				print(f"""Estimated value is {estimated_value}"""       )
				print(f"""Expected value is {expected_value}"""       )
				print(f"""Total error is {abs(estimated_value - expected_value       )}"""       )
				print('******************'       )





def 				lowercase__		(					lowerCamelCase       ):

				def function_to_integrate(lowerCamelCase       ) -> float:
								return sqrt(4.0 - x * x       )

				_SCREAMING_SNAKE_CASE   :		str       		=    area_under_curve_estimator(
				    lowerCamelCase,						lowerCamelCase,						0.0,						2.0       )

				print('******************'       )
				print('Estimating pi using area_under_curve_estimator'       )
				print(f"""Estimated value is {estimated_value}"""       )
				print(f"""Expected value is {pi}"""       )
				print(f"""Total error is {abs(estimated_value - pi       )}"""       )
				print('******************'       )


if __name__ == "__main__":
			import doctest

			doctest.testmod()









"""simple docstring"""
def 				lowercase__		(					lowerCamelCase,						lowerCamelCase       ):
				return abs(lowerCamelCase       ) if a == 0 else greatest_common_divisor(b % a,						lowerCamelCase       )





def 				lowercase__		(					lowerCamelCase,						lowerCamelCase       ):
				while y:  # --> when y=0 then loop will terminate and return x as final GCD.
								_SCREAMING_SNAKE_CASE		,						_SCREAMING_SNAKE_CASE   :		Optional[Any]       		=    y, x % y
				return abs(lowerCamelCase       )





def 				lowercase__		(					):
				try:
								_SCREAMING_SNAKE_CASE   :		Union[str, Any]       		=    input('Enter two integers separated by comma (,): '       ).split(','       )
								_SCREAMING_SNAKE_CASE   :		Dict       		=    int(nums[0]       )
								_SCREAMING_SNAKE_CASE   :		Dict       		=    int(nums[1]       )
								print(
								    f"""greatest_common_divisor({num_a}, {num_a}) = """
								    f"""{greatest_common_divisor(lowerCamelCase,						lowerCamelCase       )}"""       )
								print(f"""By iterative gcd({num_a}, {num_a}) = {gcd_by_iterative(lowerCamelCase,						lowerCamelCase       )}"""       )
				except (IndexError, UnboundLocalError, ValueError):
								print('Wrong input'       )


if __name__ == "__main__":
			main()

