Opened 13 years ago

Closed 13 years ago

# Crah with dim for lists

Reported by: Owned by: gorzel hannes major 3-1-2 and higher singular-kernel 3-1-1

### 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;
:
_=x
_=y
:
_=8y6-11y3-1
_=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);
:
_=yz
_=xz
_=x3-y3
:
_=-x*gen(1)+y*gen(2)
_=-x2*gen(2)+y2*gen(1)+z*gen(3)
:
_=0
> dim(l);    // apply dim for list of ideal resp. modules
1> typeof(LL);
ideal
> typeof(LL);
module
> dim(LL);
// ** _ is no standard basis
3
> dim(LL);
// ** _ 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
:
2
:
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)
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);
_=8y18-11y15-y12
_=12x+73016y17-106837y14+312y11-54y8+12y5-12y2
> dim(_);
0
> std(J);
_=8y18-11y15-y12
_=12x+73016y17-106837y14+312y11-54y8+12y5-12y2
> facstd(J);     // this gives the list Jfl from the beginning
:
_=y
_=x
:
_=8y6-11y3-1
_=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.

### comment:1 Changed 13 years ago by hannes

Resolution: → fixed new → closed