Ask Your Question

Evaluating discriminant of a polynomial in Z_n[x]/<x^r-1>

asked 2016-06-22 08:10:18 +0200

vishb gravatar image

updated 2016-06-22 08:10:51 +0200

Consider the following code

R = PolynomialRing(Zn,'x')
F = R.quotient((x**r)-1)

Clearly f will be a polynomial in xbar , I want to consider this polynomial as a polynomial in $ \mathbb{Z}[x] $ and evaluate its discriminant.

I tried "f.polynomial()" but it is not working. Any suggestions ?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2016-06-22 08:44:18 +0200

B r u n o gravatar image

updated 2016-06-22 19:01:28 +0200

The method you are looking for is called lift:

sage: g = f.lift()
sage: g
7*x^9 + 9*x^8 + 9*x^7 + 7*x^6 + 8*x^5 + 8*x^4 + 8*x + 8
sage: g.parent()
Univariate Polynomial Ring in x over Ring of integers modulo 14
sage: g.discriminant()

As a side comment: I created Zn = Zmod(14). If you want to work in a finite field with p elements, you should better use K = GF(p) than Zn = Zmod(p) since you are telling Sage that K is a field.

EDIT: If you want the polynomial over $\mathbb{Z}$, you can do the following:

sage: h = g.change_ring(ZZ)
sage: h.discriminant()
edit flag offensive delete link more


Nice answer. Note that this gives a polynomial over Zn, and its discriminant is computed modulo n.

slelievre gravatar imageslelievre ( 2016-06-22 09:09:58 +0200 )edit

Thanks a lot ! Can you kindly help me with this question also.

vishb gravatar imagevishb ( 2016-06-22 09:51:52 +0200 )edit

answered 2016-06-22 09:02:40 +0200

slelievre gravatar image

Your friend here is the list method, which will give you the coefficients of f as a polynomial in xbar.

Then you will be able to take its discriminant.

Let us illustrate this step by step.

To begin with, for reference, here is the Sage version used below.

sage: version()
'SageMath version 7.2, Release Date: 2016-05-15'

Let us set some values for n and r so that the code works and others can try it out.

sage: n = 13
sage: r = 7

Now define Zn, R, F, y, f as you did.

sage: Zn = Zmod(n)
sage: R = PolynomialRing(Zn, 'x')
sage: F = R.quotient(x**r-1)
sage: y = F(x+1)
sage: f = F(y**n)

We get:

sage: f
xbar^6 + 1

Get the coefficients:

sage: f.list()
[1, 0, 0, 0, 0, 0, 1]

Define the ring of polynomials over ZZ:

sage: Zx = PolynomialRing(ZZ, 'x')

The polynomial corresponding to f:

sage: ff = Zx(f.list())
sage: ff
x^6 + 1

The discriminant of this polynomial:

sage: ff.discriminant()
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

1 follower


Asked: 2016-06-22 08:10:18 +0200

Seen: 523 times

Last updated: Jun 22 '16