



'''simple docstring'''






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




def     snake_case_					(     lowerCAmelCase_		)->		List[Any]:





       '''simple docstring'''


       def is_in_circle(lowerCAmelCase_       ,   lowerCAmelCase_		) -> bool:
              _UpperCAmelCase  :						Tuple			     = 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
       _UpperCAmelCase  :						Optional[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.
       _UpperCAmelCase  :						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     snake_case_					(     lowerCAmelCase_       ,   lowerCAmelCase_       ,   lowerCAmelCase_ = 0.0       ,   lowerCAmelCase_ = 1.0       ,   )->		float:





       '''simple docstring'''


       return mean(
           function_to_integrate(uniform(lowerCAmelCase_       ,   lowerCAmelCase_		)		) for _ in range(lowerCAmelCase_		)		) * (max_value - min_value)




def     snake_case_					(     lowerCAmelCase_       ,   lowerCAmelCase_ = 0.0       ,   lowerCAmelCase_ = 1.0		)->		None:





       '''simple docstring'''


       def identity_function(lowerCAmelCase_		) -> float:
              return x

       _UpperCAmelCase  :						List[str]			     = area_under_curve_estimator(
           lowerCAmelCase_       ,   lowerCAmelCase_       ,   lowerCAmelCase_       ,   lowerCAmelCase_		)
       _UpperCAmelCase  :						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     snake_case_					(     lowerCAmelCase_		)->		None:





       '''simple docstring'''


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

       _UpperCAmelCase  :						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'''






from __future__ import annotations

from numpy import array, cos, cross, floataa, radians, sin
from numpy.typing import NDArray




def     snake_case_					(     lowerCAmelCase_       ,   lowerCAmelCase_       ,   lowerCAmelCase_ = False		)->		list[float]:





       '''simple docstring'''


       if radian_mode:
              return [magnitude * cos(lowerCAmelCase_		), magnitude * sin(lowerCAmelCase_		)]
       return [magnitude * cos(radians(lowerCAmelCase_		)		), magnitude * sin(radians(lowerCAmelCase_		)		)]




def     snake_case_					(     lowerCAmelCase_       ,   lowerCAmelCase_       ,   lowerCAmelCase_ = 10**-1		)->		bool:





       '''simple docstring'''


       _UpperCAmelCase  :						NDArray[floataa]			     = cross(lowerCAmelCase_       ,   lowerCAmelCase_		)
       _UpperCAmelCase  :						float			     = sum(lowerCAmelCase_		)
       return abs(lowerCAmelCase_		) < eps


if __name__ == "__main__":
   # Test to check if it works
   A_							: str						 =	array(
       [
           polar_force(718.4, 1_8_0 - 3_0),
           polar_force(879.54, 4_5),
           polar_force(1_0_0, -9_0),
       ]
   )

   A_							: NDArray[floataa]						 =	array([[0, 0], [0, 0], [0, 0]])

   assert in_static_equilibrium(forces, location)

   # Problem 1 in image_data/2D_problems.jpg
   A_							: List[str]						 =	array(
       [
           polar_force(3_0 * 9.81, 1_5),
           polar_force(2_1_5, 1_8_0 - 4_5),
           polar_force(2_6_4, 9_0 - 3_0),
       ]
   )

   A_							: Tuple						 =	array([[0, 0], [0, 0], [0, 0]])

   assert in_static_equilibrium(forces, location)

   # Problem in image_data/2D_problems_1.jpg
   A_							: Dict						 =	array([[0, -2_0_0_0], [0, -1_2_0_0], [0, 1_5_6_0_0], [0, -1_2_4_0_0]])

   A_							: Union[str, Any]						 =	array([[0, 0], [6, 0], [1_0, 0], [1_2, 0]])

   assert in_static_equilibrium(forces, location)

   import doctest

   doctest.testmod()



