def dup_eval(f, a, K):
 if (not a):
  return dup_TC(f, K)
 result = K.zero
 for c in f:
  result *= a
  result += c
 return result

def dup_eval ( f , a , K ) : if ( not a ) : return dup_TC ( f , K ) result = K . zero for c in f : result *= a result += c return result
evaluate a polynomial at x = a in k[x] using horner scheme .