[sage-devel] Bug in __hash__ for PermutationGroupElement

2021-01-14 Thread Johannes Schwab
Dear all,

the current implementation of __hash__ for PermutationGroupElement returns 
a hash that not only depends on the given permutation, but also on the 
group the permutation lives in.
Thus the "same" permutation (when compared with __eq__) may have different 
hash values, which is not in line with the Python documentation (
https://docs.python.org/3.5/reference/datamodel.html#object.__hash__) and 
leads to unexpected situations as the following.

sage: G = SymmetricGroup(2) 
sage: H = SymmetricGroup(1)
sage: d = {G.one() : "FooBaa"} 
sage: H.one() in list(d.keys())
True 
sage: H.one() in d
False

Best,
Johannes Schwab

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/66a4796f-19da-42aa-b530-4f7f70402979n%40googlegroups.com.


[sage-devel] Re: Bug in groebner_basis()?

2017-07-15 Thread Johannes Schwab
Oh, thank you! Sometimes it's a good idea to have a look at the 
documentation of ALL used functions...
Sorry for the trouble.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Bug in groebner_basis()?

2017-07-14 Thread Johannes Schwab
Hello,

I think I stumbled across a bug in groebner_basis(). The example below 
doesn't generate the unique reduced Groebner basis of the ideal generated 
by f and g, but instead the set 

[y^3 + 2*y^2 - x - y, x^2 + 2*y, x*y - y^2 + 1]
is returned.

This set isn't a Groebner basis at all. The correct basis should be
[1 - 2*y^2 + 2*y^3 + y^4, x + y - 2*y^2 - y^3]
.

Here is the code:
R. = PolynomialRing(QQ, 'lex')
f = x^2 + 2*y
g = x*y - y^2 + 1
I = ideal([f,g])
print I.groebner_basis()

I tested it with version 6.7, 8.0.rc1 and on sagecell.sagemath.org and with 
different algorithms as argument to groebner_basis(), the result is always the 
same.

Is this a bug, or do I have some stupid error in my code?

Regards,
Johannes

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.