I’m working with GAP and Wolfram languages at the same time. Sometimes, I must use the data generated by GAP as the input of Wolfram. In this case, a tough problem is converting the irrational number expression of GAP to the corresponding wolfram language command. The following is an example of my current practice:
exp//ClearAll;
exp[n_]:=Exp[2 Pi I/n]
In[430]:= (*gap> conjPGBC157:=FindTransformationMatrix(PGBC157);*)
conjPGBC157="[ [ 0, 1, -E(3)^2 ], [ 0, -E(3), E(3) ], [ 1, 0, 0 ] ]"//StringTrim//StringReplace[#,{"["->"{","]"->"}","I"->"E(4)",RegularExpression["E\\(([^)]+)\\)"]->"exp[$1]"} ]&//ToExpression
(*gap> repPGGenSetBC157:=List(PGGenSetBC157, x->x^conjPGBC157);*)
repPGGenSetBC157="[ [ [ 1, 0, 0 ], [ 0, E(3), 0 ], [ 0, 0, E(3)^2 ] ], [ [ 1, 0, 0 ], [ 0, 0, 1 ], [ 0, 1, 0 ] ] ]"//StringTrim//StringReplace[#,{"["->"{","]"->"}","I "->"E(4)",RegularExpression["E\\(([^)]+)\\)"]->"exp[$1]"} ]&//ToExpression
Out[430]= {{0, 1, -E^(-((2 I \[Pi])/3))}, {0, -E^(((2 I \[Pi])/3)),
E^((2 I \[Pi])/3)}, {1, 0, 0}}
Out[431]= {{{1, 0, 0}, {0, E^((2 I \[Pi])/3), 0}, {0, 0,
E^(-((2 I \[Pi])/3))}}, {{1, 0, 0}, {0, 0, 1}, {0, 1, 0}}}
In short, Exp[2 Pi I/4], aka, I, is expressed as E(4) in GAP, and Exp[2 Pi I/n] corresponds to the representation of cyclotomic numbers, aka, E(n). If I try to use the output data by GAP in Wolfram language, the above conversion must be done first correctly.
Although I have shown one approach above, it is too cumbersome to implement. I wonder if there is a better way to solve the problem.
Regards,
Zhao