Ask Your Question
0

Cant factor certain polynomials over Gaussian integers

asked 2024-03-21 05:37:15 +0200

mlv gravatar image

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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2024-03-21 13:16:37 +0200

Max Alekseyev gravatar image

updated 2024-03-21 13:18:44 +0200

Factorization of polynomials over non-fields is generally not implemented, with a notable exception of ZZ. There is no (yet?) such implementation for non-monic polynomials over Gaussian integers.

As for I0, apparently it denotes the generator of ZZ[I] to distinguish it from I, which is a generator of QQ[I]. Btw, it is more straightforward to use GaussianIntegers() rather than ZZ[I]. Check this out:

print( GaussianIntegers() )
print( ZZ[I] )
print( I.parent() )
print( ZZ[I](I).parent() )
edit flag offensive delete link more

Comments

Thanks for the explanation. I was hoping someone to point out a mistake on my code, so I can still non-monic polynomials over Gaussian integers.

Hope someone can fix this issue soon, so factoring 15*t^2+60 can be factored over the above 4 rings/fields: ZZ, QQ, ZZ[I] and QQ[I] using the same consistent syntax and approach.

mlv gravatar imagemlv ( 2024-03-22 16:07:49 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2024-03-21 05:37:15 +0200

Seen: 104 times

Last updated: Mar 21