Ask Your Question
2

Factoring a polynomial over a finite Field

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

fagui gravatar image

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

slelievre gravatar image

Hello

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
f.factor()

i get an error message

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

  File "/tmp/tmpYgKq_W/___code___.py", 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/constructor.py", 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

Comments

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 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
4

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

slelievre gravatar image

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

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
True
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

Comments

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

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

2 followers

Stats

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

Seen: 7,826 times

Last updated: Jun 06 '16