Opened 7 years ago

Last modified 2 years ago

#16993 closed defect

Broken fraction field of rational polynomial ring — at Version 9

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:

Status badges

Description (last modified by slelievre)

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

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

Fixed by #16268.

Change History (9)

comment:1 Changed 7 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 7 years ago by tscrim

  • Cc tscrim added

comment:3 Changed 6 years ago by mkoeppe

  • Cc yzh mkoeppe added

comment:4 Changed 6 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 6 years ago by etn40ff

  • Cc etn40ff added

comment:6 Changed 6 years ago by rws

  • Component changed from basic arithmetic to commutative algebra

comment:7 Changed 3 years 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
sage: p.reduce()
sage: p

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

comment:8 Changed 3 years ago by mmezzarobba

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

comment:9 Changed 2 years ago by slelievre

  • Cc slelievre added
  • Description modified (diff)
Note: See TracTickets for help on using tickets.