Opened 12 years ago

Closed 12 years ago

## #331 closed bug (fixed)

# Cleardenom does not work correctly over integer and coefficient rings.

Reported by: | gorzel | Owned by: | seelisch |
---|---|---|---|

Priority: | minor | Milestone: | 3-1-3 and higher |

Component: | singular-kernel | Version: | 3-1-2 |

Keywords: | Cc: |

### Description

Ok in char 0:

> ring r0 = 0,x,dp; > cleardenom(-x2+x); x2-x > cleardenom(-4x2+2x); 2x2-x > cleardenom(-4x2+3x); 4x2-3x

If the leading term is -1, then cleardenom should normalize the polynomial. This means that all coefficients have to be multiplied with -1 not only the first one.

See here, small bug over Z, units are +/-1:

> ring rZ = integer,x,dp; > cleardenom(-x2+x); -x2+x > cleardenom(-4x2+3x); // it should give 4x2-3x -4x2+3x

Now over Z_10:

> ring r10 = (integer,10),x,dp; > cleardenom(3x+6); // OK x+2 > 1/number(3); // 3 is a unit 7 > cleardenom(3x-6); // all correct here x+8 > cleardenom(-3x-6); x+2 > cleardenom(-3x+6); x+8

How is exactlly cleardenom defined in this case? The following results are OK, but which generator of the units do you choose?

> cleardenom(-4x2+2x); // *7 , 7== -3 2x2+4x > cleardenom(4x2+2x); // * 3 2x2+6x > cleardenom(4x2+7x); // *3 2x2+x

But bug now in Z_8:

> ring rZ8 =(integer,8),x,dp; > cleardenom(-4x2+3x); // Wrong, by division with -1 4x2+3x // it schould give 4x2+5x > cleardenom(-x2+x); // Ok. x2+7x > _*(-1)== -x2+x; 1 > cleardenom(-4x2+2x); // wrong, it should give 4x2+6x 4x2+2x

**Note:**See TracTickets for help on using tickets.

Ok, we now also change sign if the leading coef is negative, i.e. cancel out -1.

General rule is: We compute the largest unit, u, contained in the leading term and then multiply the whole term by the inverse of u. (Internally, u will always be delivered as a positive number. Thus, if the leading coef is negative, we multiply by -1/u, to also change the sign.)

Your examples over Z/8Z are all correct, since -4 = 4 (mod 8).