Ask Your Question

Revision history [back]

The reason is that Sage's polynomial rings work with expanded polynomials, and the coefficients in the (latter) expanded polynomial are too big to fit in 16 bits:

sage: R.<x> = QQ[]
sage: f = (x+1)^3*(x+2)^3*(x+3)^3*(x+4)^3; f
x^12 + 30*x^11 + 405*x^10 + 3250*x^9 + 17247*x^8 + 63690*x^7 + 167615*x^6 + 316350*x^5 + 424428*x^4 + 94280*x^3 + 240480*x^2 + 86400*x + 13824
sage: f.change_ring(ComplexField(16))
x^12 + 30.00*x^11 + 405.0*x^10 + 3250.*x^9 + 17250.*x^8 + 63690.*x^7 + 167600.*x^6 + 316400.*x^5 + 424400.*x^4 + 394300.*x^3 + 240500.*x^2 + 86400.*x + 13820.

You can also see the problem by adding print q statements to your code.