Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#392 closed bug (fixed)

bug in sqrfree

Reported by: mlee Owned by: mlee
Priority: minor Milestone: 3-1-4 and higher
Component: factory Version: 3-1-3
Keywords: Cc:

Description (last modified by mlee)

ring r=3,(x,y,z),dp; poly f=(x-y)3*(x+z)*(y-z); sqrfree(f); _[1]=-xy+xz-yz+z2

Change History (6)

comment:1 Changed 11 years ago by mlee

Description: modified (diff)

comment:2 Changed 11 years ago by gorzel

Ich verfolge gerade die Aenderungen zu diesem Ticket:

Waere es nicht besser als Rueckgabewert von sqrfree einfach ein qudratfreies polynom mit Leitkoeff 1 zu haben?

Dann kann man auch einfach f == sqrfree(f) abfragen. Den derzeitigen Rueckgabewert als ideal erhaelt man doch auch mittels des Befehls fectorize(f,1);

Andererseits ist die Resultat von sqrfree irritierend wie folgende Beispiele zeigen: (Mit Singular 3-1-3 nightly-build 29.11.2011)

>  ring r0 = 0,(x,y),dp;
> sqrfree((2x2-8)^1*x*y*(x+2));
_[1]=x2-2x
_[2]=x+2
_[3]=y
> factorize((2x2-8)^1*x*y*(x+2),1);
_[1]=x
_[2]=x-2
_[3]=x+2
_[4]=y

>  sqrfree((2x2-8)^1*x*y*(y+2));
_[1]=x3-4x
_[2]=y2+2y
>  factorize((2x2-8)^1*x*y*(y+2),1);
_[1]=x
_[2]=x-2
_[3]=x+2
_[4]=y
_[5]=y+2

comment:3 Changed 11 years ago by mlee

Resolution: fixed
Status: newclosed

fixed with 14462 (master) and c71a43 (spielwiese)

comment:4 Changed 11 years ago by gorzel

Could somebody also update

Singular-3-1-3-share.tar.gz

in nighlty builds ? (required by the changes made in paraplanecurves.lib due to changed sqrfree)

comment:5 Changed 11 years ago by anonymous

Some comments and still a bug:

1.) There is a problem with the sign:

In the following two examples, it is not wrong but not as expected,

> ring r0 = 0,(x,y),dp;
> sqrfree((x-y)*(x+y));
[1]:
   _[1]=-1                   // why this coeff -1 ?
   _[2]=-x2+y2
[2]:
   1,1
> sqrfree((x-y)*(x+y),1);
_[1]=-x2+y2                    // it should be x2-y2 here 
> sqrfree((x-y)*(x+y),3);      // OK here
x2-y2

> ring r=3,(x,y,z),dp;
> poly f=(x-y)^3*(x+z)*(y-z);
> sqrfree(f);
[1]:
   _[1]=1
   _[2]=-xy+xz-yz+z2
   _[3]=-x+y
[2]:
   1,1,3

but in this prime char case a check f==sqrfree(f,3) will fail:

> ring r3=3,(x,y,z),dp;
> sqrfree((x-y)*(x+y),3);   // BUG here 
-x2+y2
> _ == (x-y)*(x+y);
0

2.) Are the commands squarefree and allsquarefree from hnowther.lib now obsolote?

I had the impression that sqrfree runs faster, it may to be verified again.

3.) The behaviour of sqrfree with its different with its options is built close to

factorize. But I think to give favour to the version sqrfree( ,3) as the default behaviour of sqrfree would be the most convenient case for the user.

Certainly, it will make some additional work to revise it again.

(Edit: signed. Ch. Gorzel, forget to login for this comment)

Last edited 11 years ago by gorzel (previous) (diff)

comment:6 in reply to:  5 Changed 11 years ago by mlee

Replying to anonymous:

In the following two examples, it is not wrong but not as expected,

> ring r0 = 0,(x,y),dp;
> sqrfree((x-y)*(x+y));
[1]:
   _[1]=-1                   // why this coeff -1 ?
   _[2]=-x2+y2
[2]:
   1,1

For the squarefree factorization a main variable is chosen, in this case y. Hence the -1

> ring r3=3,(x,y,z),dp;
> sqrfree((x-y)*(x+y),3);   // BUG here 
-x2+y2
> _ == (x-y)*(x+y);
0

This is fixed with 572657 in git

2.) Are the commands squarefree and allsquarefree from hnowther.lib now obsolote?

I had the impression that sqrfree runs faster, it may to be verified again.

Yes.

3.) The behaviour of sqrfree with its different with its options is built close to

factorize. But I think to give favour to the version sqrfree( ,3) as the default behaviour of sqrfree would be the most convenient case for the user.

Certainly, it will make some additional work to revise it again.

(Edit: signed. Ch. Gorzel, forget to login for this comment)

I will leave it like that since the command was to compute the squarefree decomposition of a polynomial and not just the squarefree part.

Note: See TracTickets for help on using tickets.