






"""simple docstring"""






from __future__ import annotations

from collections.abc import MutableSequence




class 							lowerCAmelCase__				:






      '''simple docstring'''

      def __init__(						self     :  List[str]						,	lowercase_     :  int						,	lowercase_     :  MutableSequence[float]):




          '''simple docstring'''


          if len(lowercase_) != degree + 1:
              raise ValueError(
                  '''The number of coefficients should be equal to the degree + 1.''')

          SCREAMING_SNAKE_CASE_      :  list[float]    						=		list(lowercase_)
          SCREAMING_SNAKE_CASE_      :  str    						=		degree
      def __add__(						self     :  int						,	lowercase_     :  Polynomial):




          '''simple docstring'''


          if self.degree > polynomial_a.degree:
              SCREAMING_SNAKE_CASE_      :  List[str]    						=		self.coefficients[:]
              for i in range(polynomial_a.degree + 1):
                  coefficients[i] += polynomial_a.coefficients[i]
              return Polynomial(self.degree						,	lowercase_)
          else:
              SCREAMING_SNAKE_CASE_      :  int    						=		polynomial_a.coefficients[:]
              for i in range(self.degree + 1):
                  coefficients[i] += self.coefficients[i]
              return Polynomial(polynomial_a.degree						,	lowercase_)
      def __sub__(						self     :  str						,	lowercase_     :  Polynomial):




          '''simple docstring'''


          return self + polynomial_a * Polynomial(0						,	[-1])
      def __neg__(						self     :  str):




          '''simple docstring'''


          return Polynomial(self.degree						,	[-c for c in self.coefficients])
      def __mul__(						self     :  List[Any]						,	lowercase_     :  Polynomial):




          '''simple docstring'''


          SCREAMING_SNAKE_CASE_      :  list[float]    						=		[0] * (self.degree + polynomial_a.degree + 1)
          for i in range(self.degree + 1):
              for j in range(polynomial_a.degree + 1):
                  coefficients[i + j] += (
                      self.coefficients[i] * polynomial_a.coefficients[j]
                  )

          return Polynomial(self.degree + polynomial_a.degree						,	lowercase_)
      def _SCREAMING_SNAKE_CASE (						self     :  Tuple						,	lowercase_     :  int | float):




          '''simple docstring'''


          SCREAMING_SNAKE_CASE_      :  int | float    						=		0
          for i in range(self.degree + 1):
              result += self.coefficients[i] * (substitution**i)
          return result
      def __str__(						self     :  List[str]):




          '''simple docstring'''


          SCREAMING_SNAKE_CASE_      :  List[Any]    						=		''''''
          for i in range(self.degree						,	-1						,	-1):
              if self.coefficients[i] == 0:
                  continue
              elif self.coefficients[i] > 0:
                  if polynomial:
                      polynomial += " + "
              else:
                  polynomial += " - "

              if i == 0:
                  polynomial += str(abs(self.coefficients[i]))
              elif i == 1:
                  polynomial += str(abs(self.coefficients[i])) + "x"
              else:
                  polynomial += str(abs(self.coefficients[i])) + "x^" + str(lowercase_)

          return polynomial
      def __repr__(						self     :  Tuple):




          '''simple docstring'''


          return self.__str__()
      def _SCREAMING_SNAKE_CASE (						self     :  Optional[int]):




          '''simple docstring'''


          SCREAMING_SNAKE_CASE_      :  list[float]    						=		[0] * self.degree
          for i in range(self.degree):
              SCREAMING_SNAKE_CASE_      :  Union[str, Any]    						=		self.coefficients[i + 1] * (i + 1)
          return Polynomial(self.degree - 1						,	lowercase_)
      def _SCREAMING_SNAKE_CASE (						self     :  str						,	lowercase_     :  int | float = 0):




          '''simple docstring'''


          SCREAMING_SNAKE_CASE_      :  list[float]    						=		[0] * (self.degree + 2)
          SCREAMING_SNAKE_CASE_      :  Any    						=		constant
          for i in range(self.degree + 1):
              SCREAMING_SNAKE_CASE_      :  Union[str, Any]    						=		self.coefficients[i] / (i + 1)
          return Polynomial(self.degree + 1						,	lowercase_)
      def __eq__(						self     :  str						,	lowercase_     :  object):




          '''simple docstring'''


          if not isinstance(lowercase_						,	lowercase_):
              return False

          if self.degree != polynomial_a.degree:
              return False

          for i in range(self.degree + 1):
              if self.coefficients[i] != polynomial_a.coefficients[i]:
                  return False

          return True



      def __ne__(						self     :  Union[str, Any]						,	lowercase_     :  object):




          '''simple docstring'''


          return not self.__eq__(lowercase_)



from math import factorial, radians




def       _snake_case	(   lowerCAmelCase							:   float   , lowerCAmelCase							:   int = 1_8   , lowerCAmelCase							:   int = 1_0	):
		"""simple docstring"""







		SCREAMING_SNAKE_CASE_  :		List[str]				      =    angle_in_degrees - ((angle_in_degrees // 360.0) * 360.0)

		# Converting from degrees to radians
		SCREAMING_SNAKE_CASE_  :		Tuple				      =    radians(lowerCAmelCase	)

		SCREAMING_SNAKE_CASE_  :		Optional[Any]				      =    angle_in_radians
		SCREAMING_SNAKE_CASE_  :		List[str]				      =    3
		SCREAMING_SNAKE_CASE_  :		str				      =    -1

		for _ in range(lowerCAmelCase	):
				result += (b * (angle_in_radians**a)) / factorial(lowerCAmelCase	)

				SCREAMING_SNAKE_CASE_  :		Dict				      =    -b  # One positive term and the next will be negative and so on...
				a += 2  # Increased by 2 for every term.

		return round(lowerCAmelCase   , lowerCAmelCase	)


if __name__ == "__main__":
		__import__('''doctest''').testmod()
