def gf_diff(f, p, K):
 df = gf_degree(f)
 (h, n) = (([K.zero] * df), df)
 for coeff in f[:(-1)]:
  coeff *= K(n)
  coeff %= p
  if coeff:
   h[(df - n)] = coeff
  n -= 1
 return gf_strip(h)

def gf_diff ( f , p , K ) : df = gf_degree ( f ) ( h , n ) = ( ( [ K . zero ] * df ) , df ) for coeff in f [ : ( - 1 ) ] : coeff *= K ( n ) coeff %= p if coeff : h [ ( df - n ) ] = coeff n -= 1 return gf_strip ( h )
differentiate polynomial in gf(p)[x] .