GAP - Is it possible to work with symbolic expressions?

220 Views Asked by At

Is GAP capable of symbolic calculations?

For example, I would like to be able to expand and simplify long algebraic expressions such as $(ab+c)^4(a+3d)-bd+11$, define a matrix $\begin{pmatrix} a & b \\ c & d \end{pmatrix}$ and take its powers and perform similar formal operations without necessarily specifying numerical values of the variables. Ideally, one should be able to specify a ring and then the program would respect its properties (ie $12x=5x$ over $\mathbb{F}_7$ or the fact that $a^{2^m}=(-a)^{2^m}$ for all $a, m \in \mathbb{Z})$.

Browsing through the documentation, I wasn't able to find anything, but it seems that it should be possible considering how many more impressive tasks it can carry out. Is there a package for that or something similar? If not, I would also be interested in other suggestions for symbolic calculators.

1

There are 1 best solutions below

2
On

GAP can work with polynomials and rational functions, also in finite characteristic with appropriate reduction.

gap> a:=X(GF(2),"a");;b:=X(GF(2),"b");;
gap> c:=X(GF(2),"c");;d:=X(GF(2),"d");;
gap> mat:=[[a,b],[c,d]];;
gap> DeterminantMat(mat);
a*d+b*c
gap> Display(mat^3);
[ [                a^3+b*c*d,  a^2*b+a*b*d+b^2*c+b*d^2 ],
  [  a^2*c+a*c*d+b*c^2+c*d^2,                a*b*c+d^3 ] ]
gap> Display(mat^-1);
[ [  d/(a*d+b*c),  b/(a*d+b*c) ],
  [  c/(a*d+b*c),  a/(a*d+b*c) ] ]
gap> mat:=[[a,b],[c,1]]*a^0;;
gap> DeterminantMat(mat);
b*c+a

Just (as in the last example, make sure (by multiplication with the constant polynomial) that everything is written over the same ring.

However it will work over the algebraic closure of the field, i.e. there never will be a reduction of exponents. One can (and I have done so in the past to work over $\mathbb{F}_3^{2m+1}$ for symbolic $m$) write one's own representation of objects for a symbolic representation of a particular field, but there is nothing predefined, nor would existing routines make special accommodation of such objects