Converting multivariable polynomial with complex coefficients to a polynomial with integer coefficients
If we make a polynomial involving √−2 like this
X = PolynomialRing(CC, names='X').gen()
r0 = (X**2 + 2).roots()[0][0]
A,B = PolynomialRing(CC, 2, names='A,B').gens()
poly = (A + B + r0)*(A + B - r0)
we get poly=A2+2.00AB+B2+2.00.
How can this be changed into a polynomial with integer coefficients ?
If we had a univariate polynomial we could do this by mapping list(poly) to a list of integers and then defining a new polynomial with those. But this approach can't be translated directly to multivariable polynomials.