New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explain coefficient domain handling in groebner()'s docstring #5555

Open
pernici opened this Issue Jun 8, 2011 · 7 comments

Comments

Projects
None yet
4 participants
@pernici
Copy link
Contributor

pernici commented Jun 8, 2011

groebner does not give the groebner basis in monic form.
sdp_groebner does, but then polytools.groebner changes the normalizazion
when domain.has_Field is False. 
see e.g. the cyclic5 lex example:

>>> from sympy import *
>>> x0,x1,x2,x3,x4 = X = symbols('x0,x1,x2,x3,x4')
>>> I = [x0 + x1 + x2 + x3 + x4, x0*x1 + x0*x4 + x1*x2 + x2*x3 + x3*x4, x0*x1*x2 + x0*x1*x4 + x0*x3*x4 + x1*x2*x3 + x2*x3*x4, x0*x1*x2*x3 + x0*x1*x2*x4 + x0*x1*x3*x4 + x0*x2*x3*x4 + x1*x2*x3*x4, x0*x1*x2*x3*x4 - 1]
>>> G = groebner(I, X, order='lex')
>>> G[1]
275*x1**2 + 825*x1*x4 + 550*x3**6*x4 + 1650*x3**5*x4**2 + 275*x3**4*x4**3 - 550*x3**3*x4**4 + 275*x3**2 - 566*x3*x4**11 - 69003*x3*x4**6 + 69019*x3*x4 - 1467*x4**12 - 178981*x4**7 + 179073*x4**2

instead x1**2 should be normalized to 1
Setting by hand domain.has_Field = True one gets the correct normalization;
this function should find that for this example domain.has_Field = True.

Original issue for #5555: http://code.google.com/p/sympy/issues/detail?id=2456
Original author: https://code.google.com/u/107755593449647463741/
Original owner: https://code.google.com/u/101069955704897915480/

@mattpap

This comment has been minimized.

Copy link
Member

mattpap commented Jun 7, 2011

The last part, i.e. "domain.has_Field = True" in this example is not True, because the initial coefficient domain is integer ring (it doesn't matter that Groebner bases are computed over a field). If you want the resulting basis to be over a field, tell groebner() precisely what you want to achieve, e.g.:

In [1]: F = [x*y - 2*y, 2*y**2 - x**2]

In [2]: groebner(F, order='grevlex')
Out[2]: 
⎡ 3      2     2      2           ⎤
⎣x  - 2⋅x , - x  + 2⋅y , x⋅y - 2⋅y⎦

In [3]: groebner(F, order='grevlex', field=True)
Out[3]: 
⎡              2                ⎤
⎢ 3      2    x     2           ⎥
⎢x  - 2⋅x , - ── + y , x⋅y - 2⋅y⎥
⎣             2                 ⎦

All functions in sympy.polys always find a minimal coefficient domain for input polynomials, if needed, extend it to perform computations and retract it to the original domain if possible. In the case of groebner() the simples what to specify what you want is to set field=True. You can also say domain=QQ, but this will make your code useless for composite domains, finite fields, etc.

btw. When you submit a bug report, use a minimal example that reproduces a problem (unless a minimal example is that big). That saves time and makes it possible to reply with the same example, not with a shorter, but unrelated one. Also please explain why something should or should not be done ("should be normalized to 1").

**Labels:** Polynomial  

Original comment: http://code.google.com/p/sympy/issues/detail?id=2456#c1
Original author: https://code.google.com/u/101069955704897915480/

@asmeurer

This comment has been minimized.

Copy link
Member

asmeurer commented Jun 7, 2011

So should this be marked as WontFix, or is there still an issue here?

Original comment: http://code.google.com/p/sympy/issues/detail?id=2456#c2
Original author: https://code.google.com/u/asmeurer@gmail.com/

@mattpap

This comment has been minimized.

Copy link
Member

mattpap commented Jun 7, 2011

Lets see if there will be any rationale for a different behavior. If not, this is WontFix, because the current behavior is intended, coherent (across sympy.polys) and tested. This is also how other symbolic systems work.

Original comment: http://code.google.com/p/sympy/issues/detail?id=2456#c3
Original author: https://code.google.com/u/101069955704897915480/

@pernici

This comment has been minimized.

Copy link
Contributor

pernici commented Jun 7, 2011

Thank you for the explanation; I understand now that this is not a bug.

Mario

Original comment: http://code.google.com/p/sympy/issues/detail?id=2456#c4
Original author: https://code.google.com/u/107755593449647463741/

@mattpap

This comment has been minimized.

Copy link
Member

mattpap commented Jun 7, 2011

@mattpap

This comment has been minimized.

Copy link
Member

mattpap commented Jun 7, 2011

Actually it would be good to explain this behavior in groebner()'s docstring.

**Summary:** Explain coefficient domain handling in groebner()'s docstring  
**Status:** Accepted  
**Owner:** matt...@gmail.com  

Original comment: http://code.google.com/p/sympy/issues/detail?id=2456#c6
Original author: https://code.google.com/u/101069955704897915480/

@asmeurer

This comment has been minimized.

Copy link
Member

asmeurer commented Mar 20, 2012

skirpichev added a commit to skirpichev/diofant that referenced this issue Oct 6, 2018

skirpichev added a commit to skirpichev/diofant that referenced this issue Oct 6, 2018

skirpichev added a commit to skirpichev/diofant that referenced this issue Oct 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment