2

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.

mathmo
  • 1,192
  • I am using parigp and sagemath/jupyter-notebook for this kind of stuff. –  Jun 30 '20 at 11:30
  • I downloaded Sage and I have problems with examples I mentioned I would like to do. For example, after var('a m'), assume(m, 'integer') and a=2^m, I get a.is_integer() as False. How can I resolve that? And also how can I set variables as taking values in finite fields? – mathmo Jun 30 '20 at 13:19

1 Answers1

2

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

ahulpke
  • 18,416
  • 1
  • 21
  • 38
  • Thank you for your answer! However, I don't see how this works even in very simple cases: After a:=X(Integers,"a");;b:=X(Integers,"b");; and a^b; the output is a. How to make sense of that? – mathmo Jul 02 '20 at 07:32
  • 1
    $a^b$ is defined as conjugation -- $b^-1ab$. There are no symbolic exponents. – ahulpke Jul 03 '20 at 03:54