# Revision history [back]

### character table of a finite field

I am trying to calculate the character table of a finite field. The following is my code:

def character_table(q,n):
k=GF(q^n)
tr(x)=sum[(x^(q^i) for i in [0..n-1])]
L=[tr(x) for x in K]
ksi = e^(2*pi*I/n)
chi(x)=ksi^(tr(x))
for a in K:
L_a = [chi(a*x) for x in K]
print L_a


And the TypeError is 'function' object has no attribute '__getitem__'. Can somebody help me how to fix the code?

Thanks

Blockquote

### character table of a finite field

I am trying to calculate the character table of a finite field. The following is my code:

def character_table(q,n):
k=GF(q^n)
tr(x)=sum[(x^(q^i)     tr(x)=sum(x^(q^i) for i in [0..n-1])]
L=[tr(x) for x in K]
[0..n-1])
ksi = e^(2*pi*I/n)
chi(x)=ksi^(tr(x))
for a in K:
k:
L_a = [chi(a*x) for x in K]
k]
print L_a


And the TypeError is 'function' object has no attribute '__getitem__'. "free variable 'x' referenced before assignment in enclosing scope". Can somebody help me how to fix the code?

Thanks

Blockquote

 3 retagged FrédéricC 4131 ●3 ●37 ●85

### character table of a finite field

I am trying to calculate the character table of a finite field. The following is my code:

def character_table(q,n):
k=GF(q^n)
tr(x)=sum(x^(q^i) for i in [0..n-1])
ksi = e^(2*pi*I/n)
chi(x)=ksi^(tr(x))
for a in k:
L_a = [chi(a*x) for x in k]
print L_a


And the TypeError is "free variable 'x' referenced before assignment in enclosing scope". Can somebody help me how to fix the code?

Thanks

Blockquote