Skip to content

Commit

Permalink
ENHANCE: String for words uses conjugation
Browse files Browse the repository at this point in the history
  • Loading branch information
hulpke committed May 28, 2019
1 parent 9c31757 commit 0e5b141
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion lib/wordrep.gi
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,35 @@ local a,n,t,
i,j,
str;

str:= "";

# is it conjugate?
i:=1;
j:=Length(l);
while i+1<j and l[i]=-l[j] do
i:=i+1;
j:=j-1;
od;
if l[i]<>-l[j] then
i:=i-1;
j:=j+1;
fi;
if i>0 then
# write as conjugate
str:=DoNSAW(l{[i+1..j-1]},names,tseed);
if i+2<j or l[i+1]<0 then
# multiple symbols, need parentheses
str:=Concatenation("(",str,")");
fi;
a:=DoNSAW(l{[j..Length(l)]},names,tseed);
if j<Length(l) or l[Length(l)]<0 then
# multiple symbols, need parentheses
a:=Concatenation("(",a,")");
fi;
str:=Concatenation(str,"^",a);
return str;
fi;

n:=Length(names);
if (PRINTWORDPOWERS=true
or (IsInt(PRINTWORDPOWERS) and Length(l)<PRINTWORDPOWERS)) and
Expand All @@ -229,7 +258,6 @@ local a,n,t,
a[2]:=Concatenation(tseed,a[2]);

i:= 1;
str:= "";
while i <= Length(word) do
if i>1 then
Add( str, '*' );
Expand Down

0 comments on commit 0e5b141

Please sign in to comment.