



'''simple docstring'''





_UpperCamelCase							    =						1000

def 	a_					(							_lowerCAmelCase	)				->				float:
  return x * x

def 	a_					(							_lowerCAmelCase	,_lowerCAmelCase	,_lowerCAmelCase	,_lowerCAmelCase = 4	)				->				float:
  assert callable(
      _lowerCAmelCase	), F'the function(object) passed should be callable your input : {function}'
  assert isinstance(_lowerCAmelCase	,(float, int)	), F'a should be float or integer your input : {a}'
  assert isinstance(function(_lowerCAmelCase	)	,(float, int)	), (
      "the function should return integer or float return type of your function, "
      F'{type(_lowerCAmelCase	)}'
  )
  assert isinstance(_lowerCAmelCase	,(float, int)	), F'b should be float or integer your input : {b}'
  assert (
      isinstance(_lowerCAmelCase	,_lowerCAmelCase	) and precision > 0
  ), F'precision should be positive integer your input : {precision}'

  # just applying the formula of simpson for approximate integration written in
  # mentioned article in first comment of this file and above this function

  __lowerCamelCase	:	Optional[int]   	=			(b - a) / N_STEPS
  __lowerCamelCase	:	int   	=			function(_lowerCAmelCase	) + function(_lowerCAmelCase	)

  for i in range(1	,_lowerCAmelCase	):
    __lowerCamelCase	:	Optional[int]   	=			a + h * i
    result += function(_lowerCAmelCase	) * (4 if i % 2 else 2)

  result *= h / 3
  return round(_lowerCAmelCase	,_lowerCAmelCase	)


if __name__ == "__main__":
   import doctest

   doctest.testmod()










'''simple docstring'''





import random






class  lowerCamelCase_   :
  """simple docstring"""




  def __init__(			self				:     Union[str, Any]      ,     _a				:     float      ,     _a				:     float       ) -> None:
    __lowerCamelCase	:	Optional[int]   	=			x
    __lowerCamelCase	:	Union[str, Any]   	=			y




  def 						_lowercase					(			self				:     Tuple       ) -> bool:
    return (self.x**2 + self.y**2) <= 1




  @classmethod
  def 						_lowercase					(			cls				:     List[Any]       ) -> Optional[int]:
    return cls(x=random.random()      ,     y=random.random()       )




def 	a_					(							_lowerCAmelCase	)				->				float:
  if number_of_simulations < 1:
    raise ValueError('At least one simulation is necessary to estimate PI.'	)

  __lowerCamelCase	:	Optional[int]   	=			0
  for _ in range(_lowerCAmelCase	):
    __lowerCamelCase	:	Dict   	=			Point.random_unit_square()

    if random_point.is_in_unit_circle():
      number_in_unit_circle += 1

  return 4 * number_in_unit_circle / number_of_simulations


if __name__ == "__main__":
   # import doctest

   # doctest.testmod()
   from math import pi

   _UpperCamelCase							    =						'Please enter the desired number of Monte Carlo simulations: '
   _UpperCamelCase							    =						estimate_pi(int(input(prompt).strip()))
   print(f'''An estimate of PI is {my_pi} with an error of {abs(my_pi - pi)}''')






