def dup_compose(f, g, K):
 if (len(g) <= 1):
  return dup_strip([dup_eval(f, dup_LC(g, K), K)])
 if (not f):
  return []
 h = [f[0]]
 for c in f[1:]:
  h = dup_mul(h, g, K)
  h = dup_add_term(h, c, 0, K)
 return h

def dup_compose ( f , g , K ) : if ( len ( g ) <= 1 ) : return dup_strip ( [ dup_eval ( f , dup_LC ( g , K ) , K ) ] ) if ( not f ) : return [ ] h = [ f [ 0 ] ] for c in f [ 1 : ] : h = dup_mul ( h , g , K ) h = dup_add_term ( h , c , 0 , K ) return h
evaluate functional composition f(g) in k[x] .