Skip to content
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

is_squarefree() over multivariate rings does not work #12198

Closed
sagetrac-MvanBeek mannequin opened this issue Dec 20, 2011 · 12 comments
Closed

is_squarefree() over multivariate rings does not work #12198

sagetrac-MvanBeek mannequin opened this issue Dec 20, 2011 · 12 comments

Comments

@sagetrac-MvanBeek
Copy link
Mannequin

sagetrac-MvanBeek mannequin commented Dec 20, 2011

The following examples demonstrate the problem:

sage: R.<x,y>=PolynomialRing(ZZ)
sage: R(1).is_squarefree()
False
sage: R(x^2+y^2).is_squarefree()
False
sage: R(x^2+1).is_squarefree()
False

CC: @malb @burcin @jpflori

Component: basic arithmetic

Keywords: squarefree, singular

Stopgaps: todo

Reviewer: Travis Scrimshaw

Issue created by migration from https://trac.sagemath.org/ticket/12198

@sagetrac-MvanBeek sagetrac-MvanBeek mannequin added this to the sage-5.11 milestone Dec 20, 2011
@vbraun
Copy link
Member

vbraun commented Dec 20, 2011

comment:1

Singular seems to have issues with square-free factorization over ZZ:

                     SINGULAR                                 /  Development
 A Computer Algebra System for Polynomial Computations       /   version 3-1-3
                                                           0<
 by: W. Decker, G.-M. Greuel, G. Pfister, H. Schoenemann     \   March 2011
FB Mathematik der Universitaet, D-67653 Kaiserslautern        \
> ring R = integer,(x,y), dp;
> poly p = x^2+y^2;
> sqrfree(p);
   ? not implemented
   ? error occurred in or before STDIN line 3: `sqrfree(p);`

This might be implemented in a more recent version, don't know about that. Looking at the Singular source there is a isSqrFreeZ function in the factory that should do the right thing. Its not clear to me why the code path doesn't end up there.

Over QQ it works fine:

> ring Q = 0,(x,y),dp;
> poly p = x^2+y^2;
> sqrfree(p);
_[1]=x2+y2

I haven't found a way to test square-freeness (as opposed to compute the squarefree factorization) from the Singular command line, is this function not exposed to the Singular interpreter?

@burcin
Copy link
Contributor

burcin commented Dec 20, 2011

comment:3

Integer coefficients are relatively new in Singular. Many fuctions do not work with them. In this case, Singular raises an error using a callback function (see sage.libs.singular.singular.libsingular_error_callback). Unfortunately we do not check for it and return wrong results.

A workaround, suggested by Martin Lee, for this immediate problem is to change_ring(QQ) and call is_squarefree() there.

If there isn't a ticket already about handling errors raised in libsingular, we should open one. Note that the magical function interface (the one you get through sage.libs.singular.ff.*) can handle Singular errors. It's only direct C library calls that should check explicitly if Singular raised an error. Perhaps we can solve it by wrapping the declarations in sage/libs/singular/singular-cdefs.pxi in a preprocessor macro which calls PyErr_Occured() after raising an exception in libsingular_error_callback().

@burcin
Copy link
Contributor

burcin commented Dec 20, 2011

Changed keywords from none to squarefree, singular

@zimmermann6
Copy link
Contributor

comment:4

the same problem happens over finite fields:

sage: R.<x,y> = GF(2)[]
sage: f=x+y
sage: f.is_squarefree()
False

If is_squarefree is wrong, it should be simply disabled.

See also #12404.

Paul

@zimmermann6
Copy link
Contributor

comment:5

see also #12129.

Paul

@jdemeyer jdemeyer modified the milestones: sage-5.11, sage-5.12 Aug 13, 2013
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.1, sage-6.2 Jan 30, 2014
@rwst
Copy link
Contributor

rwst commented Mar 1, 2014

comment:8

The Singular error output has changed in 4.0.0:

                     SINGULAR                                 /  Development
 A Computer Algebra System for Polynomial Computations       /   version 4.0.0
                                                           0<
 by: W. Decker, G.-M. Greuel, G. Pfister, H. Schoenemann     \   Dec 2013
FB Mathematik der Universitaet, D-67653 Kaiserslautern        \
// ** executing /home/ralf/Sources-Singular_4.0.0/Singular/LIB/.singularrc
> ring R = integer,(x,y), dp;
> poly p = x^2+y^2;
> sqrfree(p);
   ? not implemented for rings with rings as coeffients
   ? error occurred in or before STDIN line 3: `sqrfree(p);`

@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@sagetrac-jakobkroeker
Copy link
Mannequin

sagetrac-jakobkroeker mannequin commented Aug 25, 2015

Stopgaps: todo

@JohnCremona
Copy link
Member

comment:13

This can surely be closed since the incorrect results reported are now computed correctly. Same at #12129.

@tscrim
Copy link
Collaborator

tscrim commented Nov 13, 2017

comment:14

Agreed.

@tscrim

This comment has been minimized.

@tscrim
Copy link
Collaborator

tscrim commented Nov 13, 2017

Reviewer: Travis Scrimshaw

@tscrim tscrim removed this from the sage-6.4 milestone Nov 13, 2017
@JohnCremona
Copy link
Member

comment:16

A doctest is being added at #12129 which covers this too.

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

No branches or pull requests

9 participants