Cant factor certain polynomials over Gaussian integers
I tried to factor two simple polynomials 15t^2-60 and 15t^2+60. over the following rings: Z, Q, Z[i], and Q[i]. It is strange that attempting to do so over Z[i], Gaussian integers, will raise exceptions. But if the leading coefficient is 1, then the factorizations over Z[i] work and produce correct answers. I also noticed the 'I' in Z[i] factorization p3bf is 'I0'. Can anyone please explain why?
PRZ.<t> = PolynomialRing(ZZ) # polynomial over Z
p1a = PRZ(15*t^2 - 60); p1af = p1a.factor()
p1b = PRZ(15*t^2 + 60); p1bf = p1b.factor()
print(f'PRZ: {p1a = } {p1af = }')
print(f'PRZ: {p1b = } {p1bf = }')
PRQ.<t> = PolynomialRing(QQ) # polynomial over Q
p2a = PRQ(15*t^2 - 60); p2af = p2a.factor()
p2b = PRQ(15*t^2 + 60); p2bf = p2b.factor()
print(f'PRQ: {p2a = } {p2af = }')
print(f'PRQ: {p2b = } {p2bf = }')
PRZi.<t> = PolynomialRing(ZZ[I]) # polynomial over Z[i]
p3a = PRZi( t^2 - 4); p3af = p3a.factor() # leading coeff is 1
p3b = PRZi( t^2 + 4); p3bf = p3b.factor() # leading coeff is 1
print(f'PRZi: {p3a = } {p3af = }')
print(f'PRZi: {p3b = } {p3bf = }')
PRQi.<t> = PolynomialRing(QQ[I]) # polynomial over Q[i]
p4a = PRQi(15*t^2 - 60); p4af = p4a.factor()
p4b = PRQi(15*t^2 + 60); p4bf = p4b.factor()
print(f'PRQi: {p4a = } {p4af = }')
print(f'PRQi: {p4b = } {p4bf = }')
PRZi.<t> = PolynomialRing(ZZ[I]) # polynomial over Z[i]
p5a = PRZi(15*t^2 - 60); p5af = p5a.factor() # leading coeff is 15
p5b = PRZi(15*t^2 + 60); p5bf = p5b.factor() # leading coeff is 15
print(f'PRZi: {p5a = } {p5af = }')
print(f'PRZi: {p5b = } {p5bf = }')
The outputs are correct, except for p5a and p5b:
PRZ: p1a = 15*t^2 - 60 p1af = 3 * 5 * (t - 2) * (t + 2)
PRZ: p1b = 15*t^2 + 60 p1bf = 3 * 5 * (t^2 + 4)
PRQ: p2a = 15*t^2 - 60 p2af = (15) * (t - 2) * (t + 2)
PRQ: p2b = 15*t^2 + 60 p2bf = (15) * (t^2 + 4)
PRZi: p3a = t^2 - 4 p3af = (t - 2) * (t + 2)
PRZi: p3b = t^2 + 4 p3bf = (t - 2*I0) * (t + 2*I0)
PRQi: p4a = 15*t^2 - 60 p4af = (15) * (t - 2) * (t + 2)
PRQi: p4b = 15*t^2 + 60 p4bf = (15) * (t - 2*I) * (t + 2*I)
Factorizations of p5a and p5b will raise exceptions.