Dear Jerome,
On 1 Apr., 10:48, "[email protected]"
<[email protected]> wrote:
> G = SymmetricGroup(4)
> H = G.subgroup([G((1,2,3))])
> K = G.subgroup([G((2,3,1))])
You can see how subgroups are compared: type 'K.__cmp__??' and you'll
see the source code. It is:
def __cmp__(self, other):
if self is other:
return 0
if not isinstance(other, PermutationGroup_generic):
return -1
c = cmp(self.ambient_group(), other.ambient_group())
if c: return c
if self.is_subgroup(other):
return -1
else:
return 1
'K==H' just tests whether 'K.__cmp__(H)' returns zero. As you can see
from the code, this is the case if and *only* if K is the same object
(in computer's memory) as H.
Unfortunately, the output of G.subgroup(...) is not cached. Hence,
even though G((1,2,3))==G((2,3,1)), the two subgroups are not
considered being equal.
I think this is a bug. Before returning -1 if self.is_subgroup(other),
it should be tested whether other.is_subgroup(self), in which case 0
should be returned. Do people agree?
Yours,
Simon
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---