Closed jiahao closed 11 years ago
This is great @jiahao !
I had some ugly code for pulling the character tables from GAP lying around, so I compared the results. There seem to be small differences, however. (probably an error on my side though). Do you know what this is?
using JSON
require("youngdiagrams.jl")
immutable SymmetricGroup
n::Int
end
gap(command::String) = readall(`echo $command` | `gap -q`)
function charactertable(g::SymmetricGroup)
n = g.n
t = gap("Display(Irr(CharacterTable(\"Sym($n)\")));")
t = filter(x -> contains("-0123456789,[]", x), t)[6:end] # on some system the [6:end] should not be there...
l = JSON.parse(t)
m = Array(Int, length(l), length(l))
for i = 1:length(l)
for j = 1:length(l)
m[i, j] = l[i][j]
end
end
m
end
# Lists the partitions of the number n, the order is consistent with GAP
function partitions(n)
if n == 1
return Vector{Int}[[1]]
end
list = Vector{Int}[]
for p in partitions(n-1)
push!(list, [p, 1])
if length(p) == 1 || p[end] < p[end-1]
push!(list, [p[1:end-1], p[end]+1])
end
end
list
end
n = 5
println(charactertable(SymmetricGroup(n)))
pn = length(partitions(n))
m = zeros(Int,pn,pn)
for i = 1:pn
for j = 1:pn
m[i,j] = character(partitions(n)[i],partitions(n)[j])
end
end
println(m)
The output:
Gap character table for S_5:
7x7 Int64 Array:
1 -1 1 1 -1 -1 1
4 -2 0 1 1 0 -1
5 -1 1 -1 -1 1 0
6 0 -2 0 0 0 1
5 1 1 -1 1 -1 0
4 2 0 1 -1 0 -1
1 1 1 1 1 1 1
Young diagram character table for S_5:
7x7 Int64 Array:
1 -1 1 1 -1 -1 1
8 -2 0 1 1 0 -1
4 -1 1 -1 -1 1 0
4 0 0 0 0 0 1
4 1 1 -1 1 -1 0
2 2 0 1 -1 0 -1
1 1 1 1 1 1 1
@daviddelaat thanks for checking the code! I must confess to not being an expert and only testing the few examples given in the reference. This probably needs more debugging and I could use some help ;)
I'm also not an expert on this (that's why I pull the tables from GAP instead of writing my own algorithm ;-) ), but I'll try to take a look at this over the weekend.
The smallest value where I think it might go wrong is
character([3,1],[1,1,1,1])
which I think should give 3
but which gives 2
.
Thanks! I spent the last week away, but I'm back now. Great use of Unicode characters!
Just a slight observation: I ended up renaming the types to use CamelCase in e533608175b6452afcb5ff24d960ae1ff93d0e9b for consistency.
Begins to address #4