| 1 | initial version |
Instead of sum[(x^(q^i) for i in [0..n-1])] you want sum(x^(q^i) for i in [0..n-1]).
| 2 | No.2 Revision |
Some tips:
sum[(x^(q^i) for i in [0..n-1])]sum[...] you want sum(...).tr(x) = ..., use `def tr(x): return ...``This might be what you were trying to write:
def character_table(q, n):
k = GF(q^n)
def tr(x):
return sum(x^(q^i) for i in [0..n-1]).[0..n-1])
ksi = e^(2*pi*I/n)
def chi(x):
return ksi^(tr(x))
for a in k:
L_a = [chi(a*x) for x in k]
print L_a
Using this function returns something:
sage: character_table(3, 2)
[1, 1, 1, 1, 1, 1, 1, 1, 1]
[1, 1, -1, -1, 1, 1, 1, 1, -1]
[1, -1, -1, 1, 1, 1, 1, -1, 1]
[1, -1, 1, 1, 1, 1, -1, 1, -1]
[1, 1, 1, 1, 1, -1, 1, -1, -1]
[1, 1, 1, 1, -1, 1, -1, -1, 1]
[1, 1, 1, -1, 1, -1, -1, 1, 1]
[1, 1, -1, 1, -1, -1, 1, 1, 1]
[1, -1, 1, -1, -1, 1, 1, 1, 1]
| 3 | No.3 Revision |
Some tips:
sum[...] you want sum(...).tr(x) = ..., use `def tr(x): return ...``This might be what you were trying to write:
def character_table(q, n):
k = GF(q^n)
def tr(x):
return sum(x^(q^i) for i in [0..n-1])
ksi = e^(2*pi*I/n)
def chi(x):
return ksi^(tr(x))
for a in k:
L_a = [chi(a*x) for x in k]
print L_a
Using Calling this function returns prints something:
sage: character_table(3, 2)
[1, 1, 1, 1, 1, 1, 1, 1, 1]
[1, 1, -1, -1, 1, 1, 1, 1, -1]
[1, -1, -1, 1, 1, 1, 1, -1, 1]
[1, -1, 1, 1, 1, 1, -1, 1, -1]
[1, 1, 1, 1, 1, -1, 1, -1, -1]
[1, 1, 1, 1, -1, 1, -1, -1, 1]
[1, 1, 1, -1, 1, -1, -1, 1, 1]
[1, 1, -1, 1, -1, -1, 1, 1, 1]
[1, -1, 1, -1, -1, 1, 1, 1, 1]
| 4 | No.4 Revision |
Some tips:
sum[...] you want sum(...).tr(x) = ..., use def tr(x): return This might be what you were trying to write:
def character_table(q, n):
k = GF(q^n)
def tr(x):
return sum(x^(q^i) for i in [0..n-1])
ksi = e^(2*pi*I/n)
def chi(x):
return ksi^(tr(x))
for a in k:
L_a = [chi(a*x) for x in k]
print L_a
Calling this function prints something:
sage: character_table(3, 2)
[1, 1, 1, 1, 1, 1, 1, 1, 1]
[1, 1, -1, -1, 1, 1, 1, 1, -1]
[1, -1, -1, 1, 1, 1, 1, -1, 1]
[1, -1, 1, 1, 1, 1, -1, 1, -1]
[1, 1, 1, 1, 1, -1, 1, -1, -1]
[1, 1, 1, 1, -1, 1, -1, -1, 1]
[1, 1, 1, -1, 1, -1, -1, 1, 1]
[1, 1, -1, 1, -1, -1, 1, 1, 1]
[1, -1, 1, -1, -1, 1, 1, 1, 1]
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.