I'm making code to find the minimal faithful degree of reflection groups. There are two things that are going wrong as of now:
The function "is_AbelianGroup(G)" is not working at all, the other versions of it "G.is_abelian()" and "G.is_commutative()" are both giving the following error: AttributeError: 'sage.groups.perm_gps.permgroup_element.SymmetricGroupElement' object has no attribute 'is_abelian'.
Furthermore, when I run for Reflection Groups, I get: ValueError: the input data (2) is not valid for reflection groups.
The code is as below: sage.groups.abelian_gps.abelian_group.is_AbelianGroup(x) def getSocle(G):
Z=Center(G)
gens=Generators(Z)
genK=[]
while (IsEmpty(gens) is False):
ExtractRep(~gens, ~gen)
ord=Order(gen)
p=Factorization(ord)[1][1]
n=Factorization(ord)[1][2]
gen2=gen^(p^(n-1))
genK.append(gen2) #gen2 is the element of order p in <gen>
K= G.subgroup([genK]) #(?)
return K
def getMinimalFaithfulDegree(G):
Inter=getSocle(G)
subs=Subgroups(G)
F=[]
j=subs
while j >= 1:
sub =subs[j].subgroup
if Inter.issubset(sub) is False:
F.append(sub)
j -= 1
return F
def mu(F):
alph=0
for i in range(1,F):
alph= 1/Order(F[i])
return alph
def abelianFactors(G):
orders=[]
gens=Generators(G)
for i in gens:
orders.append(Order(i))
return orders
def aplhaAbelian(G):
orders=abelianFactors(G)
return (sum(orders))/(prod(orders)) #sum of orders of cyclic groups/the product of orders, look into syntax
def Alpha(G):
if G.is_abelian() is True: #(?)
return alphaAbelian(G)
else:
F=getMinimalFaithfulCollection(G)
return mu(F)
def SumAlpha(Glist):
s=0
for i in range(1, order(Glist)):
a=Alpha(Glist[i])
s+=a
if i == 1:
output=Sprintf("%o",a)
else:
output=Sprintf("%o + %o", output, a)
output=Sprintf("%o =", output)
return output,s
SumAlpha(ReflectionGroup(2,2,3))
Any advice on what is going wrong is greatly appreciated. Thanks.