code: def mul_at(self, other, k):
          '''Compute the multiplication between two polynomials only at the specified coefficient (this is a lot cheaper than doing the full polynomial multiplication and then extract only the required coefficient)'''
          if k > (self.degree + other.degree) or k > self.degree: return 0 # optimization: if the required coefficient is above the maximum coefficient of the resulting polynomial, we can already predict that and just return 0
  
          term = 0
  
          for i in _range(min(len(self), len(other))):
              coef1 = self.coefficients[-(k-i+1)]
              coef2 = other.coefficients[-(i+1)]
              if coef1 == 0 or coef2 == 0: continue # log(0) is undefined, skip (and in addition it's a nice optimization)
              term += coef1 * coef2
          return terf mul_at(self, other, k):
          '''Compute the multiplication between two polynomials only at the specified coefficient (this is a lot cheaper than doing the full polynomial multiplication and then extract only the required coefficient)'''
          if k > (self.degree + other.degree) or k > self.degree: return 0 # optimization: if the required coefficient is above the maximum coefficient of the resulting polynomial, we can already predict that and just return 0
  
          term = 0
  
          for i in _range(min(len(self), len(other))):
              coef1 = self.coefficients[-(k-i+1)]
              coef2 = other.coefficients[-(i+1)]
              if coef1 == 0 or coef2 == 0: continue # log(0) is undefined, skip (and in addition it's a nice optimization)
              term += coef1 * coef2
          return term
docs: Compute the multiplication between two polynomials only at the specified coefficient (this is a lot cheaper than doing the full polynomial multiplication and then extract only the required coefficient)