Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

gcd on polynomials over ZZ

In Sage 9.4, in the following code:

P.<x> = QQ[]
pol = 2*x^2 + 4*x + 6
print( gcd(pol) )
print( gcd(pol.change_ring(ZZ)) )

The first gcd works fine, while the second gcd results in

TypeError: object of type 'sage.rings.polynomial.polynomial_integer_dense_flint.Polynomial_integer_dense_flint' has no len()

There is a workaround by using gcd(pol.coefficients()), but I wonder if above error is a bug.

gcd on polynomials over ZZ

In Sage 9.4, in the following code:

P.<x> = QQ[]
pol = 2*x^2 + 4*x + 6
print( gcd(pol) )
print( gcd(pol.change_ring(ZZ)) )

The first gcd works fine, while the second gcd results in

TypeError: object of type 'sage.rings.polynomial.polynomial_integer_dense_flint.Polynomial_integer_dense_flint' has no len()

There is a workaround by using gcd(pol.coefficients()), but I wonder if above error is a bug.

PS. This gcd is essentially what is called the content of a polynomial. Surprisingly, .content() is defined for multivariate polynomials but not for univariate ones.