Opened 13 months ago

# factor() does not work in a simple case

Reported by: Owned by: gh-GMS103 major sage-9.7 factorization slelievre N/A

In Sage 9.2 on SageCell and CoCalc (same on Sage 9.3.rc2):

```sage: version()
'SageMath version 9.2, Release Date: 2020-10-24'

sage: x, y = var('x, y')

sage: f = (x - 5)*y/x - (x - 6)*y/x ; f
(x - 5)*y/x - (x - 6)*y/x

sage: f.factor()  # does not work
(x - 5)*y/x - (x - 6)*y/x

sage: (f*x).factor()  # does not work either
x*((x - 5)*y/x - (x - 6)*y/x)

sage: (f*x).expand()/x  # expected result
y/x
```

Of course, this is a very simple example showing the problem.

### comment:1 Changed 13 months ago by slelievre

• Description modified (diff)

A workaround is to factor the numerator and denominator:

```sage: f.numerator().factor() / f.denominator().factor()
y/x
```

Or, in this case, to work in the fraction field of a polynomial ring.

```sage: R = PolynomialRing(QQ, ['x', 'y'])
sage: F = R.fraction_field()
sage: F(f)
y/x
sage: F(f).factor()
x^-1 * y
```

### comment:2 Changed 13 months ago by gh-GMS103

Well, actually in this case it suffices to expand:

```sage: f.expand()
y/x
```

But I was wondering about the cause of this behaviour (I do not think I would be able to find it myself).

### comment:3 Changed 9 months ago by mkoeppe

• Milestone changed from sage-9.4 to sage-9.5

### comment:4 Changed 5 months ago by mkoeppe

• Milestone changed from sage-9.5 to sage-9.6

### comment:5 Changed 3 weeks ago by mkoeppe

• Milestone changed from sage-9.6 to sage-9.7
Note: See TracTickets for help on using tickets.