Opened 7 years ago

Closed 12 months ago

#12198 closed defect (wontfix)

is_squarefree() over multivariate rings does not work

Reported by: MvanBeek Owned by: AlexGhitza
Priority: critical Milestone: sage-duplicate/invalid/wontfix
Component: basic arithmetic Keywords: squarefree, singular
Cc: malb, burcin, jpflori Merged in:
Authors: Reviewers: Travis Scrimshaw
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps: todo

Description (last modified by tscrim)

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

Change History (17)

comment:1 Changed 7 years ago by vbraun

  • Component changed from PLEASE CHANGE to algebraic geometry
  • Owner changed from tbd to AlexGhitza

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?

comment:2 Changed 7 years ago by vbraun

  • Cc malb burcin added

comment:3 Changed 7 years ago by burcin

  • Component changed from algebraic geometry to basic arithmetic
  • Keywords squarefree singular added
  • Priority changed from major to critical

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().

comment:4 Changed 7 years ago by zimmerma

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

comment:5 Changed 7 years ago by zimmerma

see also #12129.

Paul

comment:6 Changed 5 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:7 Changed 5 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:8 Changed 5 years ago by rws

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);`

comment:9 Changed 5 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:10 Changed 4 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4

comment:11 Changed 3 years ago by jakobkroeker

  • Stopgaps set to todo

comment:12 Changed 2 years ago by jpflori

  • Cc jpflori added

comment:13 Changed 13 months ago by cremona

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

comment:14 Changed 13 months ago by tscrim

  • Description modified (diff)
  • Milestone changed from sage-6.4 to sage-duplicate/invalid/wontfix
  • Reviewers set to Travis Scrimshaw
  • Status changed from new to needs_review

Agreed.

comment:15 Changed 13 months ago by tscrim

  • Status changed from needs_review to positive_review

comment:16 Changed 13 months ago by cremona

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

comment:17 Changed 12 months ago by embray

  • Resolution set to wontfix
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.