Recasting Laurent polynomials
Hi,
I have 2 Laurent polynomials, f and g, and I'm trying to recast them into multivariable polynomials over ZZ (I'm eventually going to take their gcd).
However, I'm not able to do so on the Sage Cloud.
So far, I've tried the following:
- Extracting the monomials of f and g, and their coefficients, and reconstructed f by:
sum(map(mul,zip(f.coefficients(),f.monomials())))
However, this didn't help, because SAGE thinks the type is:
<type 'sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular'>
so I still can't take the gcd.
I also tried to recast into R.<x,y> = ZZ[], but this didn't work either: when I do
sage: f.change_ring(R)
, I get the following error:AttributeError: 'sage.rings.polynomial.laurent_polynomial.LaurentPolynomial_mpair' object has no attribute 'change_ring'
Any suggestions would be greatly appreciated!! Thanks so much.
Also, I have already seen (https://ask.sagemath.org/question/33260/gcd-of-multivariable-polynomials-and-conversion-of-laurent-polynomials-to-ordinary-polynomials/ (https://ask.sagemath.org/question/332...)), but it didn't help me fix the issue at hand. Thanks again!
Please give two simple polynomials f and g, (simple, but still relevant as an example,) and the code initializing them. Then what does it mean to "recast" them? (Mathematically...) And which gcd (over which polynomial ring) should be taken?
If your Laurent polynomials happen to be classical polynomials (no negative powers), you can do as follows:
Note that you could then define a gcd for Laurent polynomial that have no negative power quite easily.
Note that
change_ring
is for changing the base ring (ZZ in your case)