def dup_diff(f, m, K):
 if (m <= 0):
  return f
 n = dup_degree(f)
 if (n < m):
  return []
 deriv = []
 if (m == 1):
  for coeff in f[:(- m)]:
   deriv.append((K(n) * coeff))
   n -= 1
 else:
  for coeff in f[:(- m)]:
   k = n
   for i in range((n - 1), (n - m), (-1)):
    k *= i
   deriv.append((K(k) * coeff))
   n -= 1
 return dup_strip(deriv)

def dup_diff ( f , m , K ) : if ( m <= 0 ) : return f n = dup_degree ( f ) if ( n < m ) : return [ ] deriv = [ ] if ( m == 1 ) : for coeff in f [ : ( - m ) ] : deriv . append ( ( K ( n ) * coeff ) ) n -= 1 else : for coeff in f [ : ( - m ) ] : k = n for i in range ( ( n - 1 ) , ( n - m ) , ( - 1 ) ) : k *= i deriv . append ( ( K ( k ) * coeff ) ) n -= 1 return dup_strip ( deriv )
m-th order derivative of a polynomial in k[x] .