Ask Your Question

Factoring a polynomial over a finite Field

asked 2014-12-04 09:29:43 +0200

fagui gravatar image

updated 2016-06-06 20:02:29 +0200

slelievre gravatar image


I'm following a 101 algebra course, and for example, I would like to factor a polynomial on a finite field like F_9 (F_9 == ZZ/9ZZ is a field because 9 is a power of a prime number, 3)

R = PolynomialRing(GF(9),'x')
x = R.gen()
f = x^4+x^2-1
f in R

i get an error message

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "", line 10, in <module>
    exec compile(u'open("","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("UiA9IFBvbHlub21pYWxSaW5nKEdGKDkpLCd4JykKeCA9IFIuZ2VuKCkKZiA9IHheNCt4XjItMQpmIGluIFI="),globals())+"\\n"); execfile(os.path.abspath(""))
  File "", line 1, in <module>

  File "/tmp/tmpYgKq_W/", line 3, in <module>
    R = PolynomialRing(GF(_sage_const_9 ),'x')
  File "factory.pyx", line 364, in sage.structure.factory.UniqueFactory.__call__ (build/cythonized/sage/structure/factory.c:1244)
  File "/home/sage/sage-6.3/local/lib/python2.7/site-packages/sage/rings/finite_rings/", line 414, in create_key_and_extra_args
    raise ValueError("parameter 'conway' is required if no name given")
ValueError: parameter 'conway' is required if no name given

i'm running sage 6.3 notebook on windows through Oracle VM winbox. I'm a totally new user, and i've looked at the tutorial and the forum but couldn't find any example or reason why this would not work. thank you for your help.

edit retag flag offensive close merge delete


To display code in your question, select it and click the "code" button (the one with 010 101).

slelievre gravatar imageslelievre ( 2014-12-06 17:30:08 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2014-12-04 10:32:29 +0200

slelievre gravatar image

updated 2016-06-06 20:04:40 +0200

The error in your math is that the group and ring structures on F9 are not the same as those on Z/9Z. As you know, Z/nZ is a field only when n is prime.

The error in your code comes from calling GF(9). You get the same error by just this:

sage: GF(9)
ValueError: parameter 'conway' is required if no name given

Instead, you need to define the generator at the time you instantiate GF(9). Do this:

sage: F.<a> = GF(9)

Then F is defined, with a as a generator (over Z/3Z). You can check its minimal polynomial:

sage: p = a.minpoly()
sage: p 
x^2 + 2*x + 2
sage: p.parent()
Univariate Polynomial Ring in x over Finite Field of size 3

The rest of your code should work from there.

sage: R.<x> = PolynomialRing(F)
sage: f = x^4 + x^2 - 1
sage: f in R
sage: f.factor()
(x^2 + a) * (x^2 + 2*a + 1)

Edit: In Sage 7.2 you can call GF(9) without specifying a generator name or a polynomial. Your original code works in Sage 7.2.

edit flag offensive delete link more


thank you very much. yes i realized that shortly after posting !

fagui gravatar imagefagui ( 2014-12-06 09:23:16 +0200 )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



Asked: 2014-12-04 09:29:43 +0200

Seen: 7,382 times

Last updated: Jun 06 '16