How to count number of zeros in the character table of a finite group by GAP?

53 Views Asked by At

I am trying to write a function in GAP to count the number of zeros in the character table of a finite group. And I have a problem counting zeros.

Numberofzeros := function(group)

local c, irr, zeros, x, numberofzeros; 

c := CharacterTable(group);
irr := Irr(c);
zeros:=[];


for x in irr do 
zeros := Union(zeros, Positions(x, 0)); 
od;
zeros := AsSet(zeros);

numberofzeros:=Size(zeros);

return(numberofzeros); 
end;

The function Positions caused losing some zeros while counting.

Here is another code.

gap>g:=SymmetricGroup(4);

gap>L:=List(ConjugacyClasses(g),c->Representative(c));

gap>c:=CharacterTable(g);

gap>irr:=Irr(g);

gap>zeros:=[];

gap>for 1<=i,j<=Size(L) do if L[i]^irr[j]=0 then Add(zeros,(i,j)); fi; od; #(*)#

gap>Size(zeros);

The line (*) doesn't work. I don't know where the mistakes are.

Any suggestions are preferred.

1

There are 1 best solutions below

0
On

Assuming that c is your character table, Sum(Irr(c),x->Number(x,IsZero)); will give you the count of zeroes in the table.