Ask Your Question

Finding irreducible polynomials in Sage Math

asked 2020-10-29 02:35:03 -0600

Amyamy 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):
   for m in range(n+1):
        for q in Integers(p):
            if R(f).is_irreducible():
                return R(f)
edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2020-10-29 09:39:06 -0600

FrédéricC gravatar image

updated 2020-10-31 02:27:58 -0600

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


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 07:42:30 -0600 )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 08:43:10 -0600 )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


Asked: 2020-10-29 02:35:03 -0600

Seen: 63 times

Last updated: Oct 31 '20