Opened 5 years ago

Closed 8 months ago

#16993 closed defect (invalid)

Broken fraction field of rational polynomial ring

Reported by: SimonKing Owned by:
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: commutative algebra Keywords:
Cc: tscrim, yzh, mkoeppe, etn40ff, slelievre Merged in:
Authors: Reviewers: Marc Mezzarobba
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by slelievre)

sage: P.<t> = QQ[]
sage: p = 4/(-4*t)
sage: p   # OK, fractions are not automatically reduced
4/(-4*t)
sage: p.reduce()
sage: p   # What the heck...
4/(-4*t)
sage: p == -1/t   # At least sage gets this right
True

So, not only is the fraction not automatically simplified by "obvious" common factors, but also it is not simplified upon request.

Note that the fraction field of an integral polynomial ring works better.

sage: P.<t> = ZZ[]
sage: p = 4/(-4*t)
sage: p
1/-t

Fixed by #16268.

Change History (10)

comment:1 Changed 5 years ago by emassop

I think this is fixed in u/robertwb/ticket/16268 which is part of #16268. On #16268, I felt that some of the functions introduced there could not live up to their documentation for nastier rings and should be moved around. Also the description of #16268 then goes on to hashes, which IMHO should be fixed without too much extra normalisation as this normalisation is probably not possible for nasty rings. Sadly I don't have time to work on this.

Now back to this ticket: I am not sure I would call reduce broken per se: If reduce is interpreted as divide out gcd, then the behaviour makes sense to me, since 1 is a generator of the ideal 4*QQ[t] + (-4*t)*QQ[t] and therefore a gcd.

Normalisation in Q(ZZ[t]) isn't optimal either:

sage: P.<t> = ZZ[]
sage: (2*t)/(2*t+1)
2*t/(2*t + 1)
sage: (-2*t)/(-2*t-1)
-2*t/(-2*t - 1)

I think Nemo solves this (for unnasty rings) by dividing the denominator by what it calls a canonical unit. My understanding of "canonical unit" is this: It is the result of a multiplicative map from the non-zero elements to the units, that is the identity on units. (In particular if this map is called f, we have f(a/f(a)) = 1 for any non-zero element a.) In the case of QQ[t] the function "leading coefficient" works. In the case of ZZ[t] the function "sign after leading coefficient" works.

comment:2 Changed 5 years ago by tscrim

  • Cc tscrim added

comment:3 Changed 4 years ago by mkoeppe

  • Cc yzh mkoeppe added

comment:4 Changed 4 years ago by tscrim

My suggestion would be that if we create a fraction field of some commutative algebra over a field k such that k is constructed as the fraction field of R (perhaps with some extra conditions on the ring), then we create the fraction field over the algebra over R. This change would definitely require a discussion on sage-devel, and might be something we do only for polynomial rings or some other nice class of commutative algebras.

comment:5 Changed 4 years ago by etn40ff

  • Cc etn40ff added

comment:6 Changed 4 years ago by rws

  • Component changed from basic arithmetic to commutative algebra

comment:7 Changed 13 months ago by mkoeppe

  • Milestone changed from sage-6.4 to sage-duplicate/invalid/wontfix
  • Status changed from new to needs_review

With #16268, the example now works as expected:

sage: P.<t> = QQ[]
sage: p = 4/(-4*t)
sage: p
-1/t
sage: p.reduce()
sage: p
-1/t

I would suggest to close this ticket as a duplicate of #16268.

comment:8 Changed 13 months ago by mmezzarobba

  • Reviewers set to Marc Mezzarobba
  • Status changed from needs_review to positive_review

comment:9 Changed 10 months ago by slelievre

  • Cc slelievre added
  • Description modified (diff)

comment:10 Changed 8 months ago by embray

  • Resolution set to invalid
  • Status changed from positive_review to closed

Presuming these are all correctly reviewed as either duplicate, invalid, or wontfix.

Note: See TracTickets for help on using tickets.