Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # https://en.wikiversity.org/wiki/File:Symmetric_group_4;_Cayley_table;_numbers.svg
- # https://en.wikiversity.org/wiki/File:Symmetric_group_S4;_conjugacy_table.svg
- from itertools import permutations
- from sympy.combinatorics import Permutation
- from bidict import bidict
- from numpy import zeros
- perms_iter = permutations([0, 1, 2, 3])
- perms = bidict()
- for i, perm in enumerate(perms_iter):
- perms[23-i] = Permutation(perm[::-1]) # create reverse colexicographic order
- times_table = zeros([24, 24], dtype=int)
- exp_table = zeros([24, 24], dtype=int)
- conjugacy_table1 = zeros([24, 24], dtype=int)
- conjugacy_table2 = zeros([24, 24], dtype=int)
- for i in range(24):
- a = perms[i]
- for j in range(24):
- b = perms[j]
- times_table[i, j] = perms.inv[a * b]
- exp_table[i, j] = perms.inv[a ^ b]
- conjugacy_table1[i, j] = perms.inv[~b * a * b]
- conjugacy_table2[i, j] = perms.inv[b * a * ~b]
- print('times_table:\n')
- print(times_table)
- print('\n\nexp_table:\n')
- print(exp_table)
- print('\n\nconjugacy_table2:\n')
- print(conjugacy_table2)
- print('\n\nconjugacy_table1 is equal to exp_table:\n')
- print((conjugacy_table1 == exp_table).all())
- same_columns = True
- for num in range(24):
- invnum = perms.inv[~perms[num]]
- if not (conjugacy_table1[:, num] == conjugacy_table2[:, invnum]).all():
- same_columns = False
- print('\n\nconjugacy_table1 and conjugacy_table2 have the same columns:\n')
- print(same_columns)
- """
- times_table:
- [[ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23]
- [ 1 0 3 2 5 4 7 6 9 8 11 10 13 12 15 14 17 16 19 18 21 20 23 22]
- [ 2 4 0 5 1 3 8 10 6 11 7 9 14 16 12 17 13 15 20 22 18 23 19 21]
- [ 3 5 1 4 0 2 9 11 7 10 6 8 15 17 13 16 12 14 21 23 19 22 18 20]
- [ 4 2 5 0 3 1 10 8 11 6 9 7 16 14 17 12 15 13 22 20 23 18 21 19]
- [ 5 3 4 1 2 0 11 9 10 7 8 6 17 15 16 13 14 12 23 21 22 19 20 18]
- [ 6 7 12 13 18 19 0 1 14 15 20 21 2 3 8 9 22 23 4 5 10 11 16 17]
- [ 7 6 13 12 19 18 1 0 15 14 21 20 3 2 9 8 23 22 5 4 11 10 17 16]
- [ 8 10 14 16 20 22 2 4 12 17 18 23 0 5 6 11 19 21 1 3 7 9 13 15]
- [ 9 11 15 17 21 23 3 5 13 16 19 22 1 4 7 10 18 20 0 2 6 8 12 14]
- [10 8 16 14 22 20 4 2 17 12 23 18 5 0 11 6 21 19 3 1 9 7 15 13]
- [11 9 17 15 23 21 5 3 16 13 22 19 4 1 10 7 20 18 2 0 8 6 14 12]
- [12 18 6 19 7 13 14 20 0 21 1 15 8 22 2 23 3 9 10 16 4 17 5 11]
- [13 19 7 18 6 12 15 21 1 20 0 14 9 23 3 22 2 8 11 17 5 16 4 10]
- [14 20 8 22 10 16 12 18 2 23 4 17 6 19 0 21 5 11 7 13 1 15 3 9]
- [15 21 9 23 11 17 13 19 3 22 5 16 7 18 1 20 4 10 6 12 0 14 2 8]
- [16 22 10 20 8 14 17 23 4 18 2 12 11 21 5 19 0 6 9 15 3 13 1 7]
- [17 23 11 21 9 15 16 22 5 19 3 13 10 20 4 18 1 7 8 14 2 12 0 6]
- [18 12 19 6 13 7 20 14 21 0 15 1 22 8 23 2 9 3 16 10 17 4 11 5]
- [19 13 18 7 12 6 21 15 20 1 14 0 23 9 22 3 8 2 17 11 16 5 10 4]
- [20 14 22 8 16 10 18 12 23 2 17 4 19 6 21 0 11 5 13 7 15 1 9 3]
- [21 15 23 9 17 11 19 13 22 3 16 5 18 7 20 1 10 4 12 6 14 0 8 2]
- [22 16 20 10 14 8 23 17 18 4 12 2 21 11 19 5 6 0 15 9 13 3 7 1]
- [23 17 21 11 15 9 22 16 19 5 13 3 20 10 18 4 7 1 14 8 12 2 6 0]]
- exp_table:
- [[ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
- [ 1 1 5 5 2 2 1 1 21 21 14 14 5 5 21 21 6 6 2 2 14 14 6 6]
- [ 2 5 2 1 5 1 14 21 14 1 21 1 6 21 6 5 21 5 6 14 6 2 14 2]
- [ 3 4 4 3 3 4 15 20 20 15 15 20 11 19 19 11 11 19 8 12 12 8 8 12]
- [ 4 3 3 4 4 3 20 15 15 20 20 15 19 11 11 19 19 11 12 8 8 12 12 8]
- [ 5 2 1 2 1 5 21 14 1 14 1 21 21 6 5 6 5 21 14 6 2 6 2 14]
- [ 6 6 14 14 21 21 6 6 2 2 5 5 14 14 2 2 1 1 21 21 5 5 1 1]
- [ 7 7 16 16 23 23 7 7 23 23 16 16 16 16 23 23 7 7 23 23 16 16 7 7]
- [ 8 11 12 15 19 20 12 19 8 3 11 4 8 20 12 4 15 3 11 15 19 3 20 4]
- [ 9 10 17 13 22 18 13 18 22 9 17 10 10 22 18 17 9 13 9 17 13 22 10 18]
- [10 9 13 17 18 22 18 13 9 22 10 17 22 10 17 18 13 9 17 9 22 13 18 10]
- [11 8 15 12 20 19 19 12 3 8 4 11 20 8 4 12 3 15 15 11 3 19 4 20]
- [12 19 8 20 11 15 8 11 12 4 19 3 12 15 8 3 20 4 19 20 11 4 15 3]
- [13 18 10 22 9 17 9 10 18 17 13 22 17 13 22 9 10 18 22 18 17 10 9 13]
- [14 21 6 21 6 14 2 5 6 5 6 2 2 1 14 1 14 2 5 1 21 1 21 5]
- [15 20 11 19 8 12 3 4 19 11 12 8 4 3 20 15 8 12 3 4 15 20 11 19]
- [16 23 7 23 7 16 23 16 7 16 7 23 23 7 16 7 16 23 16 7 23 7 23 16]
- [17 22 9 18 10 13 22 17 13 10 18 9 18 9 10 13 22 17 13 10 9 18 17 22]
- [18 13 22 10 17 9 10 9 17 18 22 13 13 17 9 22 18 10 18 22 10 17 13 9]
- [19 12 20 8 15 11 11 8 4 12 3 19 15 12 3 8 4 20 20 19 4 11 3 15]
- [20 15 19 11 12 8 4 3 11 19 8 12 3 4 15 20 12 8 4 3 20 15 19 11]
- [21 14 21 6 14 6 5 2 5 6 2 6 1 2 1 14 2 14 1 5 1 21 5 21]
- [22 17 18 9 13 10 17 22 10 13 9 18 9 18 13 10 17 22 10 13 18 9 22 17]
- [23 16 23 7 16 7 16 23 16 7 23 7 7 23 7 16 23 16 7 16 7 23 16 23]]
- conjugacy_table2:
- [[ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
- [ 1 1 5 2 5 2 1 1 5 2 5 2 21 14 21 14 6 6 21 14 21 14 6 6]
- [ 2 5 2 5 1 1 14 21 6 6 21 14 14 21 6 6 21 14 1 1 5 2 5 2]
- [ 3 4 4 3 3 4 15 20 11 8 19 12 20 15 19 12 11 8 15 20 11 8 19 12]
- [ 4 3 3 4 4 3 20 15 19 12 11 8 15 20 11 8 19 12 20 15 19 12 11 8]
- [ 5 2 1 1 2 5 21 14 21 14 6 6 1 1 5 2 5 2 14 21 6 6 21 14]
- [ 6 6 14 21 14 21 6 6 14 21 14 21 2 5 2 5 1 1 2 5 2 5 1 1]
- [ 7 7 16 23 16 23 7 7 16 23 16 23 23 16 23 16 7 7 23 16 23 16 7 7]
- [ 8 11 12 19 15 20 12 19 8 11 20 15 8 11 12 19 15 20 3 4 4 3 3 4]
- [ 9 10 17 22 13 18 13 18 10 9 22 17 22 17 18 13 9 10 9 10 17 22 13 18]
- [10 9 13 18 17 22 18 13 22 17 10 9 9 10 17 22 13 18 22 17 18 13 9 10]
- [11 8 15 20 12 19 19 12 20 15 8 11 3 4 4 3 3 4 8 11 12 19 15 20]
- [12 19 8 11 20 15 8 11 12 19 15 20 12 19 8 11 20 15 4 3 3 4 4 3]
- [13 18 10 9 22 17 9 10 17 22 13 18 18 13 22 17 10 9 17 22 9 10 18 13]
- [14 21 6 6 21 14 2 5 2 5 1 1 6 6 14 21 14 21 5 2 1 1 2 5]
- [15 20 11 8 19 12 3 4 4 3 3 4 19 12 20 15 8 11 11 8 15 20 12 19]
- [16 23 7 7 23 16 23 16 23 16 7 7 7 7 16 23 16 23 16 23 7 7 23 16]
- [17 22 9 10 18 13 22 17 18 13 9 10 13 18 10 9 22 17 10 9 13 18 17 22]
- [18 13 22 17 10 9 10 9 13 18 17 22 17 22 9 10 18 13 18 13 22 17 10 9]
- [19 12 20 15 8 11 11 8 15 20 12 19 4 3 3 4 4 3 12 19 8 11 20 15]
- [20 15 19 12 11 8 4 3 3 4 4 3 11 8 15 20 12 19 19 12 20 15 8 11]
- [21 14 21 14 6 6 5 2 1 1 2 5 5 2 1 1 2 5 6 6 14 21 14 21]
- [22 17 18 13 9 10 17 22 9 10 18 13 10 9 13 18 17 22 13 18 10 9 22 17]
- [23 16 23 16 7 7 16 23 7 7 23 16 16 23 7 7 23 16 7 7 16 23 16 23]]
- conjugacy_table1 is equal to exp_table:
- True
- conjugacy_table1 and conjugacy_table2 have the same columns:
- True
- """
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement