Processing math: 100%
Ask Your Question
1

Finding irreducible polynomials in Sage Math

asked 4 years ago

Amyamy gravatar image

updated 3 years ago

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 Z/pZ. 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)
Preview: (hide)

Comments

By "of the form xm+q" do you mean

  • of the form xm+q where q is an element in Z/pZ or
  • of the form xm+q where q is a polynomial over Z/pZ of degree less than m?
slelievre gravatar imageslelievre ( 4 years ago )

1 Answer

Sort by » oldest newest most voted
3

answered 4 years ago

FrédéricC gravatar image

updated 4 years ago

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

Preview: (hide)
link

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 ( 4 years ago )

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

FrédéricC gravatar imageFrédéricC ( 4 years ago )

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: 4 years ago

Seen: 1,874 times

Last updated: Oct 31 '20