Ask Your Question
1

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

asked 2021-01-13 18:03:37 +0200

david marquis gravatar image

updated 2021-01-14 22:59:46 +0200

If we make a polynomial involving $\sqrt{-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 = 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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-01-14 03:01:50 +0200

tmonteil gravatar image

There seems not to be a conversion from CC to ZZ, but there is one from CC to RR and one from RR to ZZ, so you can do:

sage: p = poly.change_ring(RR).change_ring(ZZ) ; p
A^2 + 2*A*B + B^2 + 2
sage: p.parent()
Multivariate Polynomial Ring in A, B over Integer Ring
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2021-01-13 18:03:37 +0200

Seen: 108 times

Last updated: Jan 14 '21