Example #1
0
#!/usr/bin/python
import sys
sys.path.insert(1, sys.path[0] + '/..')
from groups.read  import readName
from groups.about import printAbout

if len(sys.argv) < 2:
    sys.stderr.write("Usage: %s group ...\n" % (sys.argv[0],))
    sys.exit(2)
sys.stdout.write('[\n');
first = True
for gname in sys.argv[1:]:
    g = readName(gname)
    if first:
	first = False
    else:
	sys.stdout.write(',\n')
    sys.stdout.write('\n')
    printAbout(g, out=sys.stdout, indent=' ')
sys.stdout.write('\n\n]\n')
Example #2
0
#!/usr/bin/python
import sys
sys.path.insert(1, sys.path[0] + '/..')
from groups.read import readName
from groups.about import printAbout

if len(sys.argv) < 2:
    sys.stderr.write("Usage: %s group ...\n" % (sys.argv[0], ))
    sys.exit(2)
sys.stdout.write('[\n')
first = True
for gname in sys.argv[1:]:
    g = readName(gname)
    if first:
        first = False
    else:
        sys.stdout.write(',\n')
    sys.stdout.write('\n')
    printAbout(g, out=sys.stdout, indent=' ')
sys.stdout.write('\n\n]\n')
Example #3
0
#!/usr/bin/python
import sys
sys.path.insert(1, sys.path[0] + '/..')
import groups
from groups.about import printAbout

z4 = groups.Cyclic(4)
g1 = groups.Semidirect(z4, z4, lambda y: lambda x: z4.invert(x)
                       if y % 2 else x)
gn = groups.Quotient(g1, g1.generate([(2, 2)]))  # isomorphic to Q_8
printAbout(gn)
print
Example #4
0
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""This program displays the group data (as calculated by ``groups.about``) for
   a group generated from a list of permutations specified on the command line.
   Each permutation must be written as a sequence of cycles separated by ``/``,
   where each cycle is a sequence of positive integers separated by ``,``.  For
   example, the command:
  
       symdata.py 1,2/3,4 3,4,5
  
   displays the data for the group generated by ``(1 2)(3 4)`` and ``(3 4
   5)``."""

import sys
sys.path.insert(1, sys.path[0] + '/..')
from groups       import Symmetric
from groups.about import about, printAbout
from permutation  import Permutation

if len(sys.argv) < 2:
    sys.stderr.write("Usage: %s permutation ...\n" % (sys.argv[0],))
    sys.exit(2)
perms = [Permutation.fromCycles(map(int, b.split(',')) for b in a.split('/'))
	 for a in sys.argv[1:]]
perms.sort()
data = about(Symmetric(perms[-1].degree).generate(perms))
data["name"] = '⟨' + ', '.join(map(str, perms)) + '⟩'
printAbout(data)
print
Example #5
0
# -*- coding: utf-8 -*-
"""This program displays the group data (as calculated by ``groups.about``) for
   a group generated from a list of permutations specified on the command line.
   Each permutation must be written as a sequence of cycles separated by ``/``,
   where each cycle is a sequence of positive integers separated by ``,``.  For
   example, the command:
  
       symdata.py 1,2/3,4 3,4,5
  
   displays the data for the group generated by ``(1 2)(3 4)`` and ``(3 4
   5)``."""

import sys
sys.path.insert(1, sys.path[0] + '/..')
from groups import Symmetric
from groups.about import about, printAbout
from permutation import Permutation

if len(sys.argv) < 2:
    sys.stderr.write("Usage: %s permutation ...\n" % (sys.argv[0], ))
    sys.exit(2)
perms = [
    Permutation.fromCycles(map(int, b.split(',')) for b in a.split('/'))
    for a in sys.argv[1:]
]
perms.sort()
data = about(Symmetric(perms[-1].degree).generate(perms))
data["name"] = '⟨' + ', '.join(map(str, perms)) + '⟩'
printAbout(data)
print
Example #6
0
#!/usr/bin/python
import sys
sys.path.insert(1, sys.path[0] + '/..')
import groups
from groups.about import printAbout

z4 = groups.Cyclic(4)
g1 = groups.Semidirect(z4, z4, lambda y: lambda x: z4.invert(x) if y % 2 else x)
gn = groups.Quotient(g1, g1.generate([(2,2)]))  # isomorphic to Q_8
printAbout(gn)
print