Ask Your Question
1

Set of polynomial under a certain degree

asked 2021-02-23 18:43:33 +0200

Isomorphism gravatar image

Hello everyone,

My question is the following : how to define the set of the polynomial with degree less or equal than a certain number ? In my program I want to explore all the polynomial over a finite field with a degree less or equal than d.

For now, what I do is : R.<x> = PolynomialRing(GF(2^4)) R.random_element(5)

But If I want to go through all these elements I can't use that since I get all of them...

Does someone have an idea of what I could do ? Thank you in advance

Camille

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-02-23 20:51:49 +0200

slelievre gravatar image

updated 2021-03-03 18:26:03 +0200

Polynomial rings over finite fields have a dedicated method polynomials.

It can generate polynomials of_degree something or of given max_degree.

For monic degree d polynomials, add x^d to polynomials of "max degree one less".

To illustrate, we use the field with four elements so the list stays short enough.

The field and the polynomial ring:

sage: F.<a> = GF(2^2)
sage: F
Finite Field in a of size 2^2

sage: R.<x> = PolynomialRing(F)
sage: R
Univariate Polynomial Ring in x over Finite Field in a of size 2^2

All polynomials of degree up to one:

sage: list(R.polynomials(max_degree=1))
[0
 a,
 a + 1,
 1,
 a*x,
 a*x + a,
 a*x + a + 1,
 a*x + 1,
 (a + 1)*x,
 (a + 1)*x + a,
 (a + 1)*x + a + 1,
 (a + 1)*x + 1,
 x,
 x + a,
 x + a + 1,
 x + 1]

All monic polynomials of degree two:

sage: list(x^2 + p for p in R.polynomials(max_degree=1))
[x^2,
 x^2 + a,
 x^2 + a + 1,
 x^2 + 1,
 x^2 + a*x,
 x^2 + a*x + a,
 x^2 + a*x + a + 1,
 x^2 + a*x + 1,
 x^2 + (a + 1)*x,
 x^2 + (a + 1)*x + a,
 x^2 + (a + 1)*x + a + 1,
 x^2 + (a + 1)*x + 1,
 x^2 + x,
 x^2 + x + a,
 x^2 + x + a + 1,
 x^2 + x + 1]

Aall monic polynomials up to degree 2:

sage: list(x^d + p for d in (0 .. 2) for p in R.polynomials(max_degree=d-1))
[1,
 x,
 x + a,
 x + a + 1,
 x + 1,
 x^2,
 x^2 + a,
 x^2 + a + 1,
 x^2 + 1,
 x^2 + a*x,
 x^2 + a*x + a,
 x^2 + a*x + a + 1,
 x^2 + a*x + 1,
 x^2 + (a + 1)*x,
 x^2 + (a + 1)*x + a,
 x^2 + (a + 1)*x + a + 1,
 x^2 + (a + 1)*x + 1,
 x^2 + x,
 x^2 + x + a,
 x^2 + x + a + 1,
 x^2 + x + 1]

Providing a keyword argument for generating only monic polynomials is tracked at:

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 2021-02-23 18:43:33 +0200

Seen: 75 times

Last updated: Mar 03