Opened 13 years ago

Closed 13 years ago

#254 closed bug (fixed)

Crah with dim for lists

Reported by: gorzel Owned by: hannes
Priority: major Milestone: 3-1-2 and higher
Component: singular-kernel Version: 3-1-1
Keywords: Cc:

Description

dim is applicable for list, but can cause a crash.

The manual says

5.1.20 dim

Syntax:
    dim ( ideal_expression )
    dim ( module_expression ) 
Type:
    int 
Purpose:
    computes the dimension of the ideal, resp. module, 
   generated by the leading monomials of the given generators 
   of the ideal, resp. module. 
   This is also the dimension of the ideal if it is represented
   by a standard basis....

But dim can also applied for lists of ideals work:

> ring rlp = 0,(x,y),lp;
> list Jfl = ideal(x,y),ideal (8y6-11y3-1,12x+8y5-19y2);
> Jfl;
[1]:
   _[1]=x
   _[2]=y
[2]:
   _[1]=8y6-11y3-1
   _[2]=12x+8y5-19y2
> dim(Jfl);             // How to interpret this ??
2            

Probably it was intended that dim works for resolutions? (Yet not mentionend in the manual, see above.)

> ring r=0,(x,y,z),dp;
> ideal i=xz,yz,x3-y3;
> def l = res(i,0);
> typeof(l);
resolution
> l;
 1      3      2      
r <--  r <--  r

0      1      2      
resolution not minimized yet

> list(l);
[1]:
   _[1]=yz
   _[2]=xz
   _[3]=x3-y3
[2]:
   _[1]=-x*gen(1)+y*gen(2)
   _[2]=-x2*gen(2)+y2*gen(1)+z*gen(3)
[3]:
   _[1]=0
> dim(l);    // apply dim for list of ideal resp. modules 
1> typeof(LL[1]);
ideal
> typeof(LL[2]);
module
> dim(LL[2]);
// ** _ is no standard basis
3
> dim(LL[1]);
// ** _ is no standard basis
1

But dim crashes Singular if one of the list elements is not of type ideal / module

> list L= 1,2,x;
> L;
[1]:
   1
[2]:
   2
[3]:
   x
> dim(L);
   ? element 1 is not of type module
Singular : signal 11 (v: 3113/2010071305):
current line:>>dim(L);<<
Segment fault/Bus error occurred at 81f0a6b because of 28 (r:1282221890)
please inform the authors
trying to restart...
   ? error occurred in or before STDIN line 42: `dim(L);`

The error message should be enough.

-----------------------------------

My motivation was that I assumed dim would also work correctly on the result of factsd:

It can be applied but the above result is wrong:

> ring rlp = 0,(x,y),lp;
> option(redSB);
>  poly f = 9x3y4-8y7-24x4y2+30xy5+16x5-38x2y3+16x3y+y4-2xy2+x2;
> ideal J = f,jacob(f);
> std(J);
_[1]=8y18-11y15-y12
_[2]=12x+73016y17-106837y14+312y11-54y8+12y5-12y2
> dim(_);
0
> std(J);
_[1]=8y18-11y15-y12
_[2]=12x+73016y17-106837y14+312y11-54y8+12y5-12y2
> facstd(J);     // this gives the list Jfl from the beginning
[1]:
   _[1]=y
   _[2]=x
[2]:
   _[1]=8y6-11y3-1
   _[2]=12x+8y5-19y2
> dim(_);               // this is false for factsd
2

---------------------------- An obvius enhancement, for

list L = factstd(I)

was

dim(facstd(I))

should return

-1 if dim == -1 for one of the components,

max (dim(L[i])) otherwise.

May be an additional attribut e.g. "factid" should be set

Thus one more std-computation to determine the dimension of the variety could be avoided.

Change History (1)

comment:1 Changed 13 years ago by hannes

Resolution: fixed
Status: newclosed

doc updated, additional check for automatic conversions to resolution added

Note: See TracTickets for help on using tickets.