Opened 6 years ago

Closed 6 years ago

# regression in partial_fraction_decomposition()

Reported by: Owned by: rws major sage-6.3 commutative algebra partial fractions, polynomials robertwb Ralf Stephan Peter Bruin N/A 41fbef4 (Commits) 41fbef419f6f3d3681eefd4a8f302bd1504effe2

This worked in 6.1.1. Maybe triggered in #15306. Note the sign of the denominator:

```sage: R.<x> = ZZ['x']
sage: p=(6*x^2 - 9*x + 5)/(-x^3 + 3*x^2 - 3*x + 1)
sage: p.partial_fraction_decomposition()
(0, [6/(x - 1), 3/(x^2 - 2*x + 1), 2/(x^3 - 3*x^2 + 3*x - 1)])
sage: 6/(x - 1) + 3/(x^2 - 2*x + 1) + 2/(x^3 - 3*x^2 + 3*x - 1)
(6*x^2 - 9*x + 5)/(x^3 - 3*x^2 + 3*x - 1)
```

while in SR:

```sage: var('x')
x
sage: p=(6*x^2 - 9*x + 5)/(-x^3 + 3*x^2 - 3*x + 1)
sage: p.partial_fraction()
-6/(x - 1) - 3/(x - 1)^2 - 2/(x - 1)^3
```

The minimal case, showing with odd exponents:

```sage: R.<x> = ZZ['x']
sage: p=1/(-x + 1)
sage: p.partial_fraction_decomposition()
(0, [1/(x - 1)])
```

### comment:1 Changed 6 years ago by rws

• Description modified (diff)
• Priority changed from critical to major

### comment:2 Changed 6 years ago by rws

• Description modified (diff)
• Summary changed from plain wrong results from partial_fraction_decomposition() to regression in partial_fraction_decomposition()

### comment:3 Changed 6 years ago by rws

```sage: p=1/(-x + 1)
sage: p.partial_fraction_decomposition()
(0, [-1/(x - 1)])
```

After:

```sage: p=1/(-x + 1)
sage: p.partial_fraction_decomposition()
(0, [1/(x - 1)])
```

### comment:4 Changed 6 years ago by rws

• Branch set to u/rws/regression_in_partial_fraction_decomposition__

### comment:5 Changed 6 years ago by rws

• Commit set to 41fbef419f6f3d3681eefd4a8f302bd1504effe2
• Status changed from new to needs_review

New commits:

 ​41fbef4 `16240: fix sign of numerator when factor() scrambles denominators`

### comment:6 Changed 6 years ago by pbruin

• Reviewers set to Peter Bruin

OK, I convinced myself that if the algorithm is correct in the case where the unit in the factorisation of the denominator is 1 (in which case this patch does not make a difference), then the algorithm is correct for arbitrary units if and only if the patch is applied.

As Knuth said, "I have only proved it correct, not tried it", so now running doctests.

### comment:7 Changed 6 years ago by pbruin

• Status changed from needs_review to positive_review

### comment:8 Changed 6 years ago by rws

• Authors set to Ralf Stephan

### comment:9 Changed 6 years ago by vbraun

• Branch changed from u/rws/regression_in_partial_fraction_decomposition__ to 41fbef419f6f3d3681eefd4a8f302bd1504effe2
• Resolution set to fixed
• Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.