





from __future__ import annotations

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



def 		A_    (					_lowerCAmelCase							,       _lowerCAmelCase							,       _lowerCAmelCase = False					)						->			list[float]:
 if radian_mode:
  return [magnitude * cos(_lowerCAmelCase					), magnitude * sin(_lowerCAmelCase					)]
 return [magnitude * cos(radians(_lowerCAmelCase					)					), magnitude * sin(radians(_lowerCAmelCase					)					)]



def 		A_    (					_lowerCAmelCase							,       _lowerCAmelCase							,       _lowerCAmelCase = 10**-1					)						->			bool:
 UpperCamelCase     : NDArray[floataa]	     =       cross(_lowerCAmelCase							,       _lowerCAmelCase					)
 UpperCamelCase     : float	     =       sum(_lowerCAmelCase					)
 return abs(_lowerCAmelCase					) < eps


if __name__ == "__main__":
    # Test to check if it works
    SCREAMING_SNAKE_CASE_	:					int			  =					array(
        [
            polar_force(718.4, 180 - 30),
            polar_force(879.54, 45),
            polar_force(100, -90),
        ]
    )

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

    assert in_static_equilibrium(forces, location)

    # Problem 1 in image_data/2D_problems.jpg
    SCREAMING_SNAKE_CASE_	:					int			  =					array(
        [
            polar_force(30 * 9.8_1, 15),
            polar_force(215, 180 - 45),
            polar_force(264, 90 - 30),
        ]
    )

    SCREAMING_SNAKE_CASE_	:					Optional[Any]			  =					array([[0, 0], [0, 0], [0, 0]])

    assert in_static_equilibrium(forces, location)

    # Problem in image_data/2D_problems_1.jpg
    SCREAMING_SNAKE_CASE_	:					str			  =					array([[0, -2000], [0, -1200], [0, 1_5600], [0, -1_2400]])

    SCREAMING_SNAKE_CASE_	:					Dict			  =					array([[0, 0], [6, 0], [10, 0], [12, 0]])

    assert in_static_equilibrium(forces, location)

    import doctest

    doctest.testmod()







class  A__       :  # Public class to implement a graph





      def __init__(			self	,							A_	,							A_	,							A_       ):
       '''simple docstring'''




       UpperCamelCase     : Optional[int]	     =       row
       UpperCamelCase     : Any	     =       col
       UpperCamelCase     : Optional[Any]	     =       graph





      def 	__UpperCamelCase(			self	,							A_	,							A_	,							A_       ):
       '''simple docstring'''




       return (
           0 <= i < self.ROW
           and 0 <= j < self.COL
           and not visited[i][j]
           and self.graph[i][j]
       )





      def 	__UpperCamelCase(			self	,							A_	,							A_	,							A_       ):
       '''simple docstring'''




       UpperCamelCase     : Any	     =       [-1, -1, -1, 0, 0, 1, 1, 1]  # Coordinate order
       UpperCamelCase     : Dict	     =       [-1, 0, 1, -1, 1, -1, 0, 1]
       UpperCamelCase     : Any	     =       True  # Make those cells visited
       for k in range(8       ):
        if self.is_safe(i + row_nbr[k]	,							j + col_nbr[k]	,							A_       ):
         self.diffs(i + row_nbr[k]	,							j + col_nbr[k]	,							A_       )





      def 	__UpperCamelCase(			self       ):  # And finally, count all islands.
       '''simple docstring'''




       UpperCamelCase     : str	     =       [[False for j in range(self.COL       )] for i in range(self.ROW       )]
       UpperCamelCase     : int	     =       0
       for i in range(self.ROW       ):
        for j in range(self.COL       ):
         if visited[i][j] is False and self.graph[i][j] == 1:
          self.diffs(A_	,							A_	,							A_       )
          count += 1
       return count
