def dmp_lift(f, u, K):
 if (not K.is_Algebraic):
  raise DomainError('computation can be done only in an algebraic domain')
 (F, monoms, polys) = (dmp_to_dict(f, u), [], [])
 for (monom, coeff) in F.items():
  if (not coeff.is_ground):
   monoms.append(monom)
 perms = variations([(-1), 1], len(monoms), repetition=True)
 for perm in perms:
  G = dict(F)
  for (sign, monom) in zip(perm, monoms):
   if (sign == (-1)):
    G[monom] = (- G[monom])
  polys.append(dmp_from_dict(G, u, K))
 return dmp_convert(dmp_expand(polys, u, K), u, K, K.dom)

def dmp_lift ( f , u , K ) : if ( not K . is_Algebraic ) : raise DomainError ( 'computation can be done only in an algebraic domain' ) ( F , monoms , polys ) = ( dmp_to_dict ( f , u ) , [ ] , [ ] ) for ( monom , coeff ) in F . items ( ) : if ( not coeff . is_ground ) : monoms . append ( monom ) perms = variations ( [ ( - 1 ) , 1 ] , len ( monoms ) , repetition = True ) for perm in perms : G = dict ( F ) for ( sign , monom ) in zip ( perm , monoms ) : if ( sign == ( - 1 ) ) : G [ monom ] = ( - G [ monom ] ) polys . append ( dmp_from_dict ( G , u , K ) ) return dmp_convert ( dmp_expand ( polys , u , K ) , u , K , K . dom )
convert algebraic coefficients to integers in k[x] .