





'''simple docstring'''




from __future__ import annotations

from itertools import permutations
from random import randint
from timeit import repeat






def        _lowerCAmelCase			(  )     ->     tuple[list[int], int]:
     __A						: int      =       [randint(-10_00 ,							10_00			) for i in range(10			)]
     __A						: List[str]      =       randint(-50_00 ,							50_00			)
     return (arr, r)


lowercase__    :      Tuple						=    make_dataset()






def        _lowerCAmelCase			(  __snake_case  : list[int] ,							__snake_case  : int			)     ->     tuple[int, ...]:
     for triplet in permutations(__snake_case ,							3			):
          if sum(__snake_case			) == target:
               return tuple(sorted(__snake_case			)			)
     return (0, 0, 0)






def        _lowerCAmelCase			(  __snake_case  : list[int] ,							__snake_case  : int			)     ->     tuple[int, int, int]:
     arr.sort()
     __A						: List[Any]      =       len(__snake_case			)
     for i in range(n - 1			):
          __A ,__A						: Optional[int]      =       i + 1, n - 1
          while left < right:
               if arr[i] + arr[left] + arr[right] == target:
                    return (arr[i], arr[left], arr[right])
               elif arr[i] + arr[left] + arr[right] < target:
                    left += 1
               elif arr[i] + arr[left] + arr[right] > target:
                    right -= 1
     return (0, 0, 0)






def        _lowerCAmelCase			(  )     ->     tuple[float, float]:
     __A						: Optional[int]      =       '\nfrom __main__ import dataset, triplet_sum1, triplet_sum2\n'
     __A						: List[Any]      =       '\ntriplet_sum1(*dataset)\n'
     __A						: str      =       '\ntriplet_sum2(*dataset)\n'
     __A						: str      =       repeat(setup=__snake_case ,							stmt=__snake_case ,							repeat=5 ,							number=1_00_00			)
     __A						: int      =       repeat(setup=__snake_case ,							stmt=__snake_case ,							repeat=5 ,							number=1_00_00			)
     return (min(__snake_case			), min(__snake_case			))


if __name__ == "__main__":
  from doctest import testmod

  testmod()
  lowercase__    :      Union[str, Any]						=    solution_times()
  print(f"""The time for naive implementation is {times[0]}.""")
  print(f"""The time for optimized implementation is {times[1]}.""")






'''simple docstring'''




from __future__ import annotations

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






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






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


if __name__ == "__main__":
  # Test to check if it works
  lowercase__    :      List[Any]						=    array(
      [
          polar_force(718.4, 1_80 - 30),
          polar_force(879.54, 45),
          polar_force(1_00, -90),
      ]
  )

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

  assert in_static_equilibrium(forces, location)

  # Problem 1 in image_data/2D_problems.jpg
  lowercase__    :      Dict						=    array(
      [
          polar_force(30 * 9.81, 15),
          polar_force(2_15, 1_80 - 45),
          polar_force(2_64, 90 - 30),
      ]
  )

  lowercase__    :      Any						=    array([[0, 0], [0, 0], [0, 0]])

  assert in_static_equilibrium(forces, location)

  # Problem in image_data/2D_problems_1.jpg
  lowercase__    :      Optional[int]						=    array([[0, -20_00], [0, -12_00], [0, 1_56_00], [0, -1_24_00]])

  lowercase__    :      Optional[int]						=    array([[0, 0], [6, 0], [10, 0], [12, 0]])

  assert in_static_equilibrium(forces, location)

  import doctest

  doctest.testmod()