Opened 15 years ago

Closed 15 years ago

# [with patch, with positive review] bug in unit part of factorizations of multivariate polynomials

Reported by: Owned by: William Stein Martin Albrecht major sage-2.10.1 commutative algebra N/A

### Description

Behold this behavior:

```sage: R.<a,b,c,d> = QQ[]
sage: f =  (-1) * (a - d) * (-a + b) * (b - d) * (a - c) * (b - c) * (c - d)
sage: f.factor()
(-1) * (a - d) * (-a + b) * (b - d) * (a - c) * (b - c) * (c - d)
sage: F = f.factor()
sage: F[0][0]
-1
sage: F.unit_part ()
1
```

However it should be that F.unit_part() is -1 and F[0][0] is a-d.

### comment:1 Changed 15 years ago by Michael Abshoff

Milestone: sage-2.10 → sage-2.9.2

Bug Day material?

Cheers,

Michael

### comment:2 Changed 15 years ago by Martin Albrecht

Summary: bug in unit part of factorizations of multivariate polynomials → [with patch, needs review] bug in unit part of factorizations of multivariate polynomials

The attached patch fixes the issue

### comment:3 Changed 15 years ago by ncalexan

Summary: [with patch, needs review] bug in unit part of factorizations of multivariate polynomials → [with patch, with positive review] bug in unit part of factorizations of multivariate polynomials

Patch looks reasonable. The parameter to factor() is not standard sage but seems appropriate. I say apply!

### comment:4 Changed 15 years ago by Michael Abshoff

Summary: [with patch, with positive review] bug in unit part of factorizations of multivariate polynomials → [with patch, needs rebase] bug in unit part of factorizations of multivariate polynomials

The patch no longer applies to me in 2.10.1.alpha0, so it probably needs just a rebase:

```sage-2.10.1.alpha0/devel/sage\$ patch -p1 --dry-run < trac_1391.patch
patching file sage/rings/polynomial/multi_polynomial_libsingular.pyx
Hunk #1 FAILED at 3096.
Hunk #2 succeeded at 3159 (offset 22 lines).
1 out of 2 hunks FAILED -- saving rejects to file sage/rings/polynomial/multi_polynomial_libsingular.pyx.rej
```

Cheers,

Michael