mardi 21 avril 2015

Order of group element, 'NoneType' object has no attribute 'value'

Vote count: 0

I am trying to write a function to find the order of an element of a group. I keep getting this message " 'NoneType' object has no attribute 'value' ". Here is my code :

def order_group_element(G, x):
    if not ((IsSymmetricGroup(G) or IsCyclicGroup(G)) and x in G):
       raise ValueError
   identity = G.identity()
   if x == identity:
       return 1
   a = 2
   i = x
   while not i == identity:
       i = G[i]
       a = a + 1
   return a 

My input would be similar to the following:

a = CyclicGroup(500)
print 'G[1] Order = ',order_group_element(a, a[1])

I get the error from this line in my function:

while not i == identity:

Any help would be much appreciated. Thanks, Andy.

asked 1 min ago



Order of group element, 'NoneType' object has no attribute 'value'

Aucun commentaire:

Enregistrer un commentaire