(f, u, K)
return dmp_convert(dmp_expand(polys, u, K), u, K, K.dom)
Convert algebraic coefficients to integers in ``K[X]``.

    Examples
    ========

    >>> from sympy.polys import ring, QQ
    >>> from sympy import I

    >>> K = QQ.algebraic_field(I)
    >>> R, x = ring("x", K)

    >>> f = x**2 + K([QQ(1), QQ(0)])*x + K([QQ(2), QQ(0)])

    >>> R.dmp_lift(f)
    x**8 + 2*x**6 + 9*x**4 - 8*x**2 + 16
Convert algebraic coefficients to integers in ``K[X]``.
Convert algebraic coefficients to integers in K [ X ] .
def dmp_lift(f, u, K):
    """
    Convert algebraic coefficients to integers in ``K[X]``.

    Examples
    ========

    >>> from sympy.polys import ring, QQ
    >>> from sympy import I

    >>> K = QQ.algebraic_field(I)
    >>> R, x = ring("x", K)

    >>> f = x**2 + K([QQ(1), QQ(0)])*x + K([QQ(2), QQ(0)])

    >>> R.dmp_lift(f)
    x**8 + 2*x**6 + 9*x**4 - 8*x**2 + 16

    """
    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 )