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)$.


  • $\begingroup$ 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. $\endgroup$ – Joseph Victor Aug 6 '12 at 0:28
  • 2
    $\begingroup$ 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. $\endgroup$ – Lubin Aug 6 '12 at 0:56
  • 1
    $\begingroup$ well, it's not at all hard to do in Sage, see my answer... $\endgroup$ – Dima Pasechnik Aug 7 '12 at 14:55

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; 
| cite | improve this answer | |

in maxima:

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

returns 2*u+1

| cite | improve this answer | |

In addition, Magma http://magma.maths.usyd.edu.au/magma/ and GAP http://www.gap-system.org/ 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

| cite | improve this answer | |

Here's one way to do it in Macaulay2

R = GF(5)[mu]/(mu^5-mu+1)[x]
f = x^7-1
g = x^2+x+1
sub(f, x => x+mu) + g


      7        6     2 5       2       2                 3     2
o4 = x  + 2mu*x  + mu x  + mu*x  + (2mu  - 2mu + 1)x + mu  - mu

o4 : R
| cite | improve this answer | |
  • $\begingroup$ Nice. I'm not sure if this is better, but as an additional option, it could also be f = x -> x^7-1, and then f(x+mu) and f(x)+g. $\endgroup$ – Zach Teitler Sep 19 at 5:13

In Singular:

> ring R = (5,mu),(x),dp; minpoly=mu^5-mu+1;
> poly f = x^7 - 1;
> poly g = x^2 + x + 1;
> subst(f,x,x+mu)+g;
| cite | improve this answer | |

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

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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