



"""simple docstring"""







from math import factorial, pi

def     UpperCamelCase_   (   lowerCAmelCase__				:    float   ,       lowerCAmelCase__				:    int = 30						):

  """simple docstring"""




  if not isinstance(lowerCAmelCase__   ,       (int, float)						):
    raise ValueError('maclaurin_sin() requires either an int or float for theta'						)

  if not isinstance(lowerCAmelCase__   ,       lowerCAmelCase__						) or accuracy <= 0:
    raise ValueError('maclaurin_sin() requires a positive int for accuracy'						)

  lowerCAmelCase_       :    List[str]								=			float(lowerCAmelCase__						)
  lowerCAmelCase_       :    Tuple								=			theta // (2 * pi)
  theta -= 2 * div * pi
  return sum(
      (-1) ** r * theta ** (2 * r + 1) / factorial(2 * r + 1						) for r in range(lowerCAmelCase__						)						)

def     UpperCamelCase_   (   lowerCAmelCase__				:    float   ,       lowerCAmelCase__				:    int = 30						):

  """simple docstring"""




  if not isinstance(lowerCAmelCase__   ,       (int, float)						):
    raise ValueError('maclaurin_cos() requires either an int or float for theta'						)

  if not isinstance(lowerCAmelCase__   ,       lowerCAmelCase__						) or accuracy <= 0:
    raise ValueError('maclaurin_cos() requires a positive int for accuracy'						)

  lowerCAmelCase_       :    str								=			float(lowerCAmelCase__						)
  lowerCAmelCase_       :    Tuple								=			theta // (2 * pi)
  theta -= 2 * div * pi
  return sum((-1) ** r * theta ** (2 * r) / factorial(2 * r						) for r in range(lowerCAmelCase__						)						)


if __name__ == "__main__":
     import doctest

     doctest.testmod()

     print(maclaurin_sin(1_0))
     print(maclaurin_sin(-1_0))
     print(maclaurin_sin(1_0, 1_5))
     print(maclaurin_sin(-1_0, 1_5))

     print(maclaurin_cos(5))
     print(maclaurin_cos(-5))
     print(maclaurin_cos(1_0, 1_5))
     print(maclaurin_cos(-1_0, 1_5))










"""simple docstring"""







from collections.abc import Iterable
from typing import Generic, TypeVar

lowercase__		:    Any				   =     TypeVar("""_T""")







class 				UpperCamelCase__       (     Generic[_T]  ):




      """simple docstring"""




      def __init__(				self    :				Any   ,      SCREAMING_SNAKE_CASE_    :				Iterable[_T] | None = None	):
        lowerCAmelCase_       :    list[_T]								=			list(iterable or []	)
        lowerCAmelCase_       :    list[_T]								=			[]



      def __len__(				self    :				List[str]	):
        return len(self._stacka	) + len(self._stacka	)



      def __repr__(				self    :				int	):
        return F"Queue({tuple(self._stacka[::-1] + self._stacka	)})"



      def 					SCREAMING_SNAKE_CASE__			(				self    :				Tuple   ,      SCREAMING_SNAKE_CASE_    :				_T	):
        self._stacka.append(SCREAMING_SNAKE_CASE_	)





      def 					SCREAMING_SNAKE_CASE__			(				self    :				str	):
        lowerCAmelCase_       :    List[str]								=			self._stacka.pop
        lowerCAmelCase_       :    int								=			self._stacka.append

        if not self._stacka:
          while self._stacka:
            stacka_append(stacka_pop()	)

        if not self._stacka:
          raise IndexError('Queue is empty'	)
        return self._stacka.pop()


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

     testmod()





