Ask Your Question
1

Finding irreducible polynomials in Sage Math

asked 2020-10-29 08:35:03 +0100

Amyamy gravatar image

updated 2021-07-27 19:16:33 +0100

FrédéricC gravatar image

I'm new to Sage and I'm asked to find out all the monic polynomials (of the form x^m+q) that are irreducible in the finite field $\mathbb{Z}/p\mathbb{Z}$. My idea is to vary q from 0 to p-1 and m from 1 to n, where n is the highest order of polynomials given by the user, and I want to create a function that works for all integer fields. However, my codes don't work and Sage tells me

positive characteristic not allowed in symbolic computations What does this mean?

def irr(p,n):
   R.<x>=PolynomialRing(Integers(p),'x')
   for m in range(n+1):
        for q in Integers(p):
            R(f)=x^m+q
            if R(f).is_irreducible():
                return R(f)
edit retag flag offensive close merge delete

Comments

By "of the form $x^m + q$" do you mean

  • of the form $x^m + q$ where $q$ is an element in $\mathbb{Z} / p \mathbb{Z}$ or
  • of the form $x^m + q$ where $q$ is a polynomial over $\mathbb{Z} / p \mathbb{Z}$ of degree less than $m$?
slelievre gravatar imageslelievre ( 2021-01-27 13:24:30 +0100 )edit

1 Answer

Sort by » oldest newest most voted
3

answered 2020-10-29 15:39:06 +0100

FrédéricC gravatar image

updated 2020-10-31 08:27:58 +0100

R(f)=x^m+q is trying to build a symbolic function named R with argument f. Just f = x^m+q would work

edit flag offensive delete link more

Comments

Okay, I changed R(f) to f, but now Sage always returns x. I want to find all the irreducible polynomials under a certain degree. How can I do this?

Amyamy gravatar imageAmyamy ( 2020-11-04 14:42:30 +0100 )edit

create a list, append to the list, and return the list at the end

FrédéricC gravatar imageFrédéricC ( 2020-11-04 15:43:10 +0100 )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: 2020-10-29 08:35:03 +0100

Seen: 1,346 times

Last updated: Oct 31 '20