Example #1
0
# Import the class Group from the file groups.py

from groups import Group

# Create an instance of the group (10,+)

G = Group("add", 10)

# print the group elements

G.g("show")

# Create an instance of the group (15,x)

H = Group("mult", 15)

# print the group elements

H.g("show")
Example #2
0
# Import the class Group from the file groups.py

from groups import Group

# Create an instance of the group (5,+)x(9,x)

print("Create a group (5,+)x(9,x)")
G = Group(["add", "mult"], [5, 9])

# print the group components

Gg = G.g("show")
g3 = G.g(3)
print("Element 3 = ", G.g(3))
print("Inverse of element 3 = ", G.inv(g3))

g7 = G.g(7)
g6 = G.g(6)
print("Element 7 = ", g7)
print("Element 6 = ", g6)
print("Multiplication of element 7 and element 6 = ", G.op(g7, g6))
print("Element 7 to the power of 3 = ", G.pow(g7, 3))

print("Group orders:")
Gg = G.g()
Ggo = G.go()
for (g, go) in zip(Gg, Ggo):
    print("Element ", g, " has order ", go)
Example #3
0
# Importing require modules
from groups import Group
from pure import setCrossProd

# Creating group and subgroup

print("Create (120,+)")
G = Group("add", 120)
G.g("show")
GS = G.sub([15, 30, 60])

# print the sub group components

GSg = GS.g()
GS.g("show")
print("Inverse of element 15 = ", GS.inv(15))
print("Multiplication of 15 and 30 = ", GS.op(15, 30))
print("15 to the power 3 = ", GS.pow(15, 3))

GSgo = GS.go()
for g, go in zip(GSg, GSgo):
    print("Element: ", g, " has order: ", go)
Example #4
0
# Import the class Group from the file groups.py

from groups import Group

# Create an instance of the group (10,+)

print("Creating a group (10,+)")
G = Group("add", 10)

# print the group components

G.g("show")
print("Inverse of element 3 = ", G.inv(3))
print("Multiplication of 7 and 6 = ", G.op(7, 6))
print("7 to the power 3 = ", G.pow(7, 3))

Gg = G.g()
Ggo = G.go()
GgoDict = dict(zip(Gg, Ggo))
for g in GgoDict:
    print("Element: ", g, " has order: ", GgoDict[g])

# Create an instance of the group (15,x)

print("\nCreating a group (15,x)")
H = Group("mult", 15)

# print the group components

Hh = H.g("show")
print("Inverse of element 2 = ", H.inv(2))
Example #5
0
# Import the class Group from the file groups.py

from groups import Group

# Create an instance of the group (32,x)

G = Group("mult", 32)
G.g("show")
Gg = G.g()
Ggo = G.go()
print("(32,x) sorted element orders = ", sorted(Ggo), "\n")

# Creating candidate groups

G1 = Group("add", 16)
G2 = Group(["add", "add"], [8, 2])
G3 = Group(["add", "add", "add"], [4, 2, 2])
G4 = Group(["add", "add", "add", "add"], [2, 2, 2, 2])

print("Candidate groups:")

G1go = G1.go()
print("(16,+) sorted element orders = ", sorted(G1go))
G2go = G2.go()
print("(8,+)x(2,+) sorted element orders = ", sorted(G2go))
G3go = G3.go()
print("(4,+)x(2,+)x(2,+) sorted element orders = ", sorted(G3go))
G4go = G4.go()
print("(2,+)x(2,+)x(2,+)x(2,+) sorted element orders = ", sorted(G4go), "\n")

print("Conclusion:")
Example #6
0
# Importing require modules
from groups import Group

# Creating group and subgroup

print("Create (6,+)x(9,x) group")
G = Group(["add", "mult"], [6, 9])
G.g("show")

print("Print order of [0,1] is: ", G.go([0, 1]))

print("Create sub group with elements 2 and 22")
g2 = G.g(2)
g22 = G.g(22)
GS = G.sub([g2, g22])
GSg = GS.g("show")

g2 = GS.g(2)
print("Element 2 = ", g2)
print("Inverse of element 2 = ", GS.inv(g2))
g4 = GS.g(4)
g5 = GS.g(5)
print("Element 4 = ", g4)
print("Element 5 = ", g5)
print("Multiplication of element 4 and element 5 = ", GS.op(g4, g5))
print("Element 4 to the power of 3 = ", GS.pow(g4, 3))

print("Group orders:")
GSg = GS.g()
GSgo = GS.go()
print(GSgo)