'Construct a new algebraic number.'

def __new__(cls, expr, coeffs=None, alias=None, **args):

    from sympy import Poly
    from sympy.polys.polyclasses import ANP, DMP
    from sympy.polys.numberfields import minimal_polynomial
    from sympy.core.symbol import Symbol
    expr = sympify(expr)
    if isinstance(expr, (tuple, Tuple)):
        (minpoly, root) = expr
        if (not minpoly.is_Poly):
            minpoly = Poly(minpoly)
    elif expr.is_AlgebraicNumber:
        (minpoly, root) = (expr.minpoly, expr.root)
    else:
        (minpoly, root) = (minimal_polynomial(expr, args.get('gen'), polys=True), expr)
    dom = minpoly.get_domain()
    if (coeffs is not None):
        if (not isinstance(coeffs, ANP)):
            rep = DMP.from_sympy_list(sympify(coeffs), 0, dom)
            scoeffs = Tuple(*coeffs)
        else:
            rep = DMP.from_list(coeffs.to_list(), 0, dom)
            scoeffs = Tuple(*coeffs.to_list())
        if (rep.degree() >= minpoly.degree()):
            rep = rep.rem(minpoly.rep)
    else:
        rep = DMP.from_list([1, 0], 0, dom)
        scoeffs = Tuple(1, 0)
        if root.is_negative:
            rep = (- rep)
            scoeffs = Tuple((-1), 0)
    sargs = (root, scoeffs)
    if (alias is not None):
        if (not isinstance(alias, Symbol)):
            alias = Symbol(alias)
        sargs = (sargs + (alias,))
    obj = Expr.__new__(cls, *sargs)
    obj.rep = rep
    obj.root = root
    obj.alias = alias
    obj.minpoly = minpoly
    return obj
