def dup_shift(f, a, K):
 (f, n) = (list(f), (len(f) - 1))
 for i in range(n, 0, (-1)):
  for j in range(0, i):
   f[(j + 1)] += (a * f[j])
 return f

def dup_shift ( f , a , K ) : ( f , n ) = ( list ( f ) , ( len ( f ) - 1 ) ) for i in range ( n , 0 , ( - 1 ) ) : for j in range ( 0 , i ) : f [ ( j + 1 ) ] += ( a * f [ j ] ) return f
evaluate efficiently taylor shift f in k[x] .