Ask Your Question

Revision history [back]

Converting multivariable polynomial with complex coefficients to a polynomial with integer coefficients

If we make a polynomial involving $\sqrt{-2}$ like this

X = PolynomialRing(CC, names='X').gen()
r0 = (X**2 + 2).roots()[0][0]
r1 = (X**2 + 2).roots()[0][1]
A,B = PolynomialRing(CC, 2, names='A,B').gens()
poly = (A + B + r0)*(A + B - r0)

we get $poly = A^2 + 2.00AB + B^2 + 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.

Converting multivariable polynomial with complex coefficients to a polynomial with integer coefficients

If we make a polynomial involving $\sqrt{-2}$ like this

X = PolynomialRing(CC, names='X').gen()
r0 = (X**2 + 2).roots()[0][0]
r1 = (X**2 + 2).roots()[0][1]
A,B = PolynomialRing(CC, PolynomialRing(ZZ, 2, names='A,B').gens()
poly = (A + B + r0)*(A + B - r0)

we get $poly = A^2 + 2.00AB + B^2 + 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.

Converting multivariable polynomial with complex coefficients to a polynomial with integer coefficients

If we make a polynomial involving $\sqrt{-2}$ like this

X = PolynomialRing(CC, names='X').gen()
r0 = (X**2 + 2).roots()[0][0]
r1 = (X**2 + 2).roots()[0][1]
A,B = PolynomialRing(ZZ, PolynomialRing(CC, 2, names='A,B').gens()
poly = (A + B + r0)*(A + B - r0)

we get $poly = A^2 + 2.00AB + B^2 + 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.

Converting multivariable polynomial with complex coefficients to a polynomial with integer coefficients

If we make a polynomial involving $\sqrt{-2}$ like this

X = PolynomialRing(CC, names='X').gen()
r0 = (X**2 + 2).roots()[0][0]
r1 = (X**2 + 2).roots()[0][1]
A,B = PolynomialRing(CC, 2, names='A,B').gens()
poly = (A + B + r0)*(A + B - r0)

we get $poly = A^2 + 2.00AB + B^2 + 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.