






'''simple docstring'''





from __future__ import annotations

from collections.abc import Callable





def    _lowerCamelCase	(	__lowerCamelCase   ,       __lowerCamelCase   ,       __lowerCamelCase   ,       __lowerCamelCase = 100   ,       )   -> float:

     '''simple docstring'''
     UpperCAmelCase__			:     Union[str, Any]										= x_start
     UpperCAmelCase__			:     Any										= fnc(_UpperCAmelCase					)
     UpperCAmelCase__			:     Optional[Any]										= 0.0

     for _ in range(_UpperCAmelCase					):
          # Approximates small segments of curve as linear and solve
          # for trapezoidal area
          UpperCAmelCase__			:     Tuple										= (x_end - x_start) / steps + xa
          UpperCAmelCase__			:     Dict										= fnc(_UpperCAmelCase					)
          area += abs(fxa + fxa					) * (xa - xa) / 2

          # Increment step
          UpperCAmelCase__			:     List[str]										= xa
          UpperCAmelCase__			:     List[str]										= fxa
     return area


if __name__ == "__main__":





      def    _lowerCamelCase	(	__lowerCamelCase					)   -> Optional[int]:

           '''simple docstring'''
           return x**3

      print("""f(x) = x^3""")
      print("""The area between the curve, x = -10, x = 10 and the x axis is:""")
      SCREAMING_SNAKE_CASE__		:       Tuple   							=							10
      while i <= 10_00_00:
            SCREAMING_SNAKE_CASE__		:       Optional[int]   							=							trapezoidal_area(f, -5, 5, i)
            print(f'''with {i} steps: {area}''')
            i *= 10














import random







class 							UpperCAmelCase_     :




     def __init__(							self  ,	_lowerCAmelCase  ,	_lowerCAmelCase		):
          UpperCAmelCase__			:     Union[str, Any]										= x
          UpperCAmelCase__			:     Union[str, Any]										= y




     def      __UpperCAmelCase     (							self		):
          return (self.x**2 + self.y**2) <= 1




     @classmethod
     def      __UpperCAmelCase     (							cls		):
          return cls(x=random.random()  ,	y=random.random()		)





def    _lowerCamelCase	(	__lowerCamelCase					)   -> float:

     '''simple docstring'''
     if number_of_simulations < 1:
          raise ValueError("""At least one simulation is necessary to estimate PI."""					)

     UpperCAmelCase__			:     Dict										= 0
     for _ in range(__lowerCamelCase					):
          UpperCAmelCase__			:     Union[str, Any]										= 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

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






