Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Finding irreducible polynomials in Sage Math

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)
click to hide/show revision 2
retagged

Finding irreducible polynomials in Sage Math

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)