Loading [MathJax]/jax/output/HTML-CSS/jax.js

First time here? Check out the FAQ!

Ask Your Question
1

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

asked 4 years ago

david marquis gravatar image

updated 4 years ago

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.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 4 years ago

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
Preview: (hide)
link

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: 4 years ago

Seen: 263 times

Last updated: Jan 14 '21