How to factorize a polynomial in a Skew Polynomial Ring

asked 2025-01-19 17:17:51 +0100

Sandeep gravatar image

updated 2025-01-21 08:42:48 +0100

I am trying this code, but it is not giving any output. However, the same code provides the factorization if I take the polynomial x^n+1, where n is an odd number.

k.<t>= GF(2^2)
sigma = k.frobenius_endomorphism()
S.<x>= k['x', sigma]
a=x^4+1;
count = a.count_factorizations()
print(f"Number of factorizations: {count}")
factorizations = a.factorizations() 
print("Factorizations of the polynomial:")
for factorization in factorizations:       
    print(factorization)
edit retag flag offensive close merge delete

Comments

What version of Sage are you using? Also, your post is contradictory: you say that it gives output for x^n+1 when n is an odd number, but your example has x^3+1 and you say that there is no output. Can you clarify?

John Palmieri gravatar imageJohn Palmieri ( 2025-01-20 18:32:18 +0100 )edit

FWIW, on Sage 10.6.beta3 :

sage: a
x^3 + 1
sage: a.count_factorizations()
2 # As expected
sage: F=a.factorizations()

The first use of F works :

sage: [u for u in F]
[(x^2 + x + 1) * (x + 1), (x + 1) * (x^2 + x + 1)]

but a second use fails :

sage: [u for u in F]
[]

"Spent generator" ?

sage: F
<_cython_3_0_11.generator object at 0x7fd3cccf4f70>

Regenerate it :

sage: F=a.factorizations()

First use in a loop :

sage: for f in F: print(f)
(x^2 + x + 1) * (x + 1)
(x + 1) * (x^2 + x + 1)

Works.

sage: for f in F: print(f)
sage:

Second call fails...

It seems that the _cython_3_0_11.generator object is a one-shot : first call works, then it is "spent" and won't generate anymore.

WTF ?

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2025-01-20 18:53:29 +0100 )edit

Obvious workaround :

sage: F=[u for u in a.factorizations()]
sage: for f in F: print(f)
(x + 1) * (x^2 + x + 1)
(x + 1) * (x^2 + x + 1)
sage: for f in F: print(f)
(x + 1) * (x^2 + x + 1)
(x + 1) * (x^2 + x + 1)

Second call works...

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2025-01-20 18:58:04 +0100 )edit

I apologize for the mistake. This code does not give any factors over F4 for x^n+1 when n is even. I am using Sage Version 10.4.

Sandeep gravatar imageSandeep ( 2025-01-21 08:46:38 +0100 )edit