'Convert ``self`` to an algebraic integer.'

def to_algebraic_integer(self):

    from sympy import Poly
    f = self.minpoly
    if (f.LC() == 1):
        return self
    coeff = (f.LC() ** (f.degree() - 1))
    poly = f.compose(Poly((f.gen / f.LC())))
    minpoly = (poly * coeff)
    root = (f.LC() * self.root)
    return AlgebraicNumber((minpoly, root), self.coeffs())
