Opened 14 years ago

Closed 14 years ago

enable again: division by number for integers

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

Description

Could you restore the previous behaviour of "/" for integer and related coefficient field?

Division, canceling by content, and by inverses should be allowed as before. Only division by polynomials with / which lead to a crash, should be blocked. (For division by polynomials the command division works.)

Singular 3-1-1:

```>  ring rZ = integer,x,dp;
>  poly f = 4*(x+1)^2;
>  f;
4x2+8x+4
>  f/1;
? not implemented for rings with rings as coeffients
? error occurred in or before STDIN line 4: ` f/1;`
>  f/4;
? not implemented for rings with rings as coeffients
? error occurred in or before STDIN line 5: ` f/4;`
>  f/(x+1);
? not implemented for rings with rings as coeffients
? error occurred in or before STDIN line 6: ` f/(x+1);`
>  division(f,x+1);
[1]:
_[1,1]=4x+4
[2]:
_[1]=0
[3]:
_[1,1]=1
```

The same for

``` ring r = (integer,6),x,dp;
>   poly f = 4*(x+1)^2;
>  f;
4x2+2x+4
>  f/1;
? not implemented for rings with rings as coeffients
? error occurred in or before STDIN line 37: ` f/1;`
>  f/4;
? not implemented for rings with rings as coeffients
? error occurred in or before STDIN line 38: ` f/4;`
>  f/(x+1);
? not implemented for rings with rings as coeffients
? error occurred in or before STDIN line 39: ` f/(x+1);`
>  division(f,x+1);
[1]:
_[1,1]=4x+4
[2]:
_[1]=0
[3]:
_[1,1]=1
```

Singular 3-1-0

Singular for ix86-Linux version 3-1-0 (3100-2009041418) Apr 14 2009 18:24:38

```> ring rZ = integer,x,dp;
>  poly f = 4*(x+1)^2;
>  f;
4x2+8x+4
>  f/1;
4x2+8x+4
>  f/4;      // OK
x2+2x+1
>  (f+1)/4;   // Also this behavior is Okay, see (*) below:
x2+2x

>  division(f,x+1);
[1]:
_[1,1]=4x+4
[2]:
_[1]=0
[3]:
_[1,1]=1

>  f/(x+1);    // Only this had to be blocked

error: no more memory
System 772k:776k Appl 129k/492k Malloc 110k/0k Valloc 512k/492k Pages 23/105 Regions 1:1

halt 14
```

Ad (*) compare with the interpration of / as div without mod.

```> ring r=0,x,dp;
> poly f = 4x3+x2+2x+3;
> f/x2;   // OK
4x+1
```

```>  ring rZ6 = (integer,6),x,dp;
// ** You are using coefficients rings which are not fields.
// ** Please note that only limited functionality is available
// ** for these coefficients.
// **
// ** The following commands are meant to work:
// ** - basic polynomial arithmetic
// ** - std
// ** - reduce
>  poly f = 4*(x+1)^2;
>  f;
4x2+2x+4    // OK
>  f/1;
4x2+2x+4
>  f/4;      // OK
x2+1
> division(f,x+1);   // OK
[1]:
_[1,1]=4x+4
[2]:
_[1]=0
[3]:
_[1,1]=1
>  f/(x+1);    // This had to be blocked
Singular : signal 8 (v: 3100/2009041418):
current line:>> f/(x+1);<<
Segment fault/Bus error occurred at 83c3a83 because of 0 (r:1269630750)
trying to restart...
```

------------------------------------------------------- Code to be copied:

``` ring rZ = integer,x,dp;
poly f = 4*(x+1)^2;
f;
f/1;
f/4;
division(f,x+1);
f/(x+1);

ring rZ6 = (integer,6),x,dp;
poly f = 4*(x+1)^2;
f;
f/1;
f/4;
division(f,x+1);
f/(x+1);
```

comment:1 Changed 14 years ago by seelisch

Component: dontKnow → singular-kernel changed from somebody to seelisch

comment:2 Changed 14 years ago by seelisch

Resolution: → fixed new → closed

I enabled again the division over coefficient rings which are domains. (In the moment we have just one such ring, namely Z. Over such coefficient rings, division by single-term polynomials will now work again. If the divisor consists of two or more terms, the kernel code calls factorisation routines which have not been designed for the case of coefficient domains. In this case, we therefore display a warning and do not perform the division.) Here's a screen-dump of what I just compiled and what will be included in the next minor release; please reopen this ticket if this is not ok or enough:

\$ ./Singular

SINGULAR / Development

A Computer Algebra System for Polynomial Computations / version 3-1-1

0<

by: G.-M. Greuel, G. Pfister, H. Schoenemann \ Feb 2010

FB Mathematik der Universitaet, D-67653 Kaiserslautern \ executing /cygdrive/c/Work/SINGULAR-Branches/SINGULAR-for-fixes/Singular/LIB/.singularrc

ring rZ = integer, x, dp;

You are using coefficient rings which are not fields. Please note that only limited functionality is available for these coefficients. The following commands are meant to work: - basic polynomial arithmetic - std - syz - lift - reduce

poly f = 4*(x+1)2; f/1;

4x2+8x+4

f/4;

x2+2x+1

f/8;

x

f/9;

0

f/4x;

x+2

f/(x+1);

? division over a coefficient domain only implemented for terms ? error occurred in or before STDIN line 8: `f/(x+1);`

ring rZ = integer, (x,y), dp;

You are using coefficient rings which are not fields. Please note that only limited functionality is available for these coefficients. The following commands are meant to work: - basic polynomial arithmetic - std - syz - lift - reduce redefining rZ

poly f = x2y2+2x2y+4y-6; f/2;

x2y+2y-3

f/3;

-2

f/x2;

y2+2y

f/(2x2);

y

Note: See TracTickets for help on using tickets.