MathOverflow is a question and answer site for professional mathematicians. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a computer algebra system that can do arithmetic over polynomial algebras over finite fields where I can specify the extension?

Exempli gratia, if $f(x), g(x) \in \mathbb{F}_p[\mu]/(m(\mu))[x]$, I'd like the CAS to be able to compute things like $f(x + \mu) + g(x)$ where I specify the polynomial $m(\mu)$.


share|cite|improve this question
Sage has some good stuff, but its a bit obnoxious to use. Still, I suspect you can trick Sage into doing what you want. I would love a decent finite field library myself. – Joseph Victor Aug 6 '12 at 0:28
Very large degree polynomials $f$ and $g$? I have something home-made that's primitive in comparison to Sage, but designed for just this sort of thing, yet may choke at huge degree. If you don't get better suggestions, contact me by e-mail. – Lubin Aug 6 '12 at 0:56
well, it's not at all hard to do in Sage, see my answer... – Dima Pasechnik Aug 7 '12 at 14:55
up vote 14 down vote accepted

You can do these things in Sage quite easily. Here is an example (using Sage 5.2):

sage: Fp.<mu>=GF(5)[]
sage: Fp
Univariate Polynomial Ring in mu over Finite Field of size 5
sage: m=mu^5-mu+1
sage: K.<y>=GF(5^5, name='y', modulus=m) # your mu becomes y
sage: A.<x>=K[]
sage: A
Univariate Polynomial Ring in x over Finite Field in y of size 5^5
sage: f=x^7-1
sage: f(x+y)
x^7 + 2*y*x^6 + y^2*x^5 + (y + 4)*x^2 + (2*y^2 + 3*y)*x + y^3 + 4*y^2 + 4
sage: g=x^2+x+1
sage: f(x+y)+g(x)
x^7 + 2*y*x^6 + y^2*x^5 + y*x^2 + (2*y^2 + 3*y + 1)*x + y^3 + 4*y^2

Another option is to use GAP (kindly provided by A.Konovalov)

gap> R:=PolynomialRing(GF(5),"mu"); mu:=Indeterminate(GF(5));;
gap> m:=mu^5-mu+1;
gap> T:=AlgebraicExtension(GF(5),m); a:=RootOfDefiningPolynomial(T);;
<field of size 3125>
gap> A:=PolynomialRing(T,"x"); x:=Indeterminate(T);;
gap> f:=x^7-1;
gap> Value(f,x+a);
gap> g:=x^2+x+One(T); 
gap> Value(f,x+a)+g; 
share|cite|improve this answer

in maxima:

 f(x):= x^3+x+5;

returns 2*u+1

share|cite|improve this answer

In addition, Magma and GAP will perform these computations. The former is commercial and the latter is free. If you want to compute over large finite fields, then you may want to try Magma.

Stephen Glasby

share|cite|improve this answer

Mathematica has a finite field package which might do what you want.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.