Status: Accepted
Owner: [email protected]
Labels: Type-Defect Priority-Medium

New issue 2434 by [email protected]: Polynomials are sorted incorrectly w.r.t. the grevlex term order
http://code.google.com/p/sympy/issues/detail?id=2434

Sorting polynomials wrt the grevlex term order gives incorrect results, for example:

In [4]: f=Poly(y*z+z**2-x-z)
In [5]: f.LM(order="grevlex")
Out[5]: (0, 0, 2)

The correct result would be (0, 1, 1) as (0, 1, 1) - (0, 0, 2) = (0, 1, -1) (so the rightmost entry different from 0 is negative).

Similarly:

In [50]: from sympy.polys.monomialtools import monomial_grevlex_key
In [51]: from sympy.polys.groebnertools import sdp_sort
In [52]: f=[((0,1,1),1),((0,0,2),1),((1,0,0),1),((0,0,1),1)]
In [53]: sdp_sort(f, monomial_grevlex_key)
Out[53]: [((0, 0, 2), 1), ((0, 1, 1), 1), ((0, 0, 1), 1), ((1, 0, 0), 1)]

So sdp_LC, sdp_LT and sdp_LM may give wrong results.

Interestingly:

In [54]: monomial_grevlex_cmp((0,1,1),(0,0,2))
Out[54]: 1

So, monomial_grevlex_cmp itself gives the correct answer!


--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
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/sympy-issues?hl=en.

Reply via email to