Sage: Ticket #16993: Broken fraction field of rational polynomial ring
https://trac.sagemath.org/ticket/16993
<pre class="wiki">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
</pre><p>
So, not only is the fraction not automatically simplified by "obvious" common factors, but also it is not simplified upon request.
</p>
<p>
Note that the fraction field of an integral polynomial ring works better.
</p>
<pre class="wiki">sage: P.<t> = ZZ[]
sage: p = 4/(-4*t)
sage: p
1/-t
</pre><p>
Fixed by <a class="closed ticket" href="https://trac.sagemath.org/ticket/16268" title="defect: Better normalization for fraction field elements (closed: fixed)">#16268</a>.
</p>
en-usSagehttps://trac.sagemath.org/chrome/site/logo_sagemath_trac.png
https://trac.sagemath.org/ticket/16993
Trac 1.1.6emassopTue, 16 Sep 2014 14:17:10 GMT
https://trac.sagemath.org/ticket/16993#comment:1
https://trac.sagemath.org/ticket/16993#comment:1
<p>
I think this is fixed in <a class="ext-link" href="http://git.sagemath.org/sage.git/log/?h=u/robertwb/ticket/16268"><span class="icon"></span>u/robertwb/ticket/16268</a> which is part of <a class="closed ticket" href="https://trac.sagemath.org/ticket/16268" title="defect: Better normalization for fraction field elements (closed: fixed)">#16268</a>. On <a class="closed ticket" href="https://trac.sagemath.org/ticket/16268" title="defect: Better normalization for fraction field elements (closed: fixed)">#16268</a>, 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 <a class="closed ticket" href="https://trac.sagemath.org/ticket/16268" title="defect: Better normalization for fraction field elements (closed: fixed)">#16268</a> 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.
</p>
<p>
Now back to this ticket: I am not sure I would call reduce <em>broken</em> per se: If <em>reduce</em> is interpreted as <em>divide out gcd</em>, then the behaviour makes sense to me, since 1 is a generator of the ideal <code>4*QQ[t] + (-4*t)*QQ[t]</code> and therefore a gcd.
</p>
<p>
Normalisation in Q(ZZ[t]) isn't optimal either:
</p>
<pre class="wiki">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)
</pre><p>
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 <code>f</code>, we have <code>f(a/f(a)) = 1</code> for any non-zero element <code>a</code>.) In the case of <code>QQ[t]</code> the function "leading coefficient" works. In the case of <code>ZZ[t]</code> the function "sign after leading coefficient" works.
</p>
TickettscrimSat, 20 Sep 2014 23:54:36 GMTcc set
https://trac.sagemath.org/ticket/16993#comment:2
https://trac.sagemath.org/ticket/16993#comment:2
<ul>
<li><strong>cc</strong>
<em>tscrim</em> added
</li>
</ul>
TicketmkoeppeFri, 25 Sep 2015 21:13:59 GMTcc changed
https://trac.sagemath.org/ticket/16993#comment:3
https://trac.sagemath.org/ticket/16993#comment:3
<ul>
<li><strong>cc</strong>
<em>yzh</em> <em>mkoeppe</em> added
</li>
</ul>
TickettscrimFri, 25 Sep 2015 22:03:21 GMT
https://trac.sagemath.org/ticket/16993#comment:4
https://trac.sagemath.org/ticket/16993#comment:4
<p>
My suggestion would be that if we create a fraction field of some commutative algebra over a field <code>k</code> such that <code>k</code> is constructed as the fraction field of <code>R</code> (perhaps with some extra conditions on the ring), then we create the fraction field over the algebra over <code>R</code>. 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.
</p>
Ticketetn40ffSat, 10 Oct 2015 13:04:35 GMTcc changed
https://trac.sagemath.org/ticket/16993#comment:5
https://trac.sagemath.org/ticket/16993#comment:5
<ul>
<li><strong>cc</strong>
<em>etn40ff</em> added
</li>
</ul>
TicketrwsSun, 11 Oct 2015 06:14:55 GMTcomponent changed
https://trac.sagemath.org/ticket/16993#comment:6
https://trac.sagemath.org/ticket/16993#comment:6
<ul>
<li><strong>component</strong>
changed from <em>basic arithmetic</em> to <em>commutative algebra</em>
</li>
</ul>
TicketmkoeppeFri, 14 Sep 2018 04:33:38 GMTstatus, milestone changed
https://trac.sagemath.org/ticket/16993#comment:7
https://trac.sagemath.org/ticket/16993#comment:7
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>needs_review</em>
</li>
<li><strong>milestone</strong>
changed from <em>sage-6.4</em> to <em>sage-duplicate/invalid/wontfix</em>
</li>
</ul>
<p>
With <a class="closed ticket" href="https://trac.sagemath.org/ticket/16268" title="defect: Better normalization for fraction field elements (closed: fixed)">#16268</a>, the example now works as expected:
</p>
<pre class="wiki">sage: P.<t> = QQ[]
sage: p = 4/(-4*t)
sage: p
-1/t
sage: p.reduce()
sage: p
-1/t
</pre><p>
I would suggest to close this ticket as a duplicate of <a class="closed ticket" href="https://trac.sagemath.org/ticket/16268" title="defect: Better normalization for fraction field elements (closed: fixed)">#16268</a>.
</p>
TicketmmezzarobbaSat, 22 Sep 2018 14:36:12 GMTstatus changed; reviewer set
https://trac.sagemath.org/ticket/16993#comment:8
https://trac.sagemath.org/ticket/16993#comment:8
<ul>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>positive_review</em>
</li>
<li><strong>reviewer</strong>
set to <em>Marc Mezzarobba</em>
</li>
</ul>
TicketslelievreFri, 28 Dec 2018 09:31:35 GMTcc, description changed
https://trac.sagemath.org/ticket/16993#comment:9
https://trac.sagemath.org/ticket/16993#comment:9
<ul>
<li><strong>cc</strong>
<em>slelievre</em> added
</li>
<li><strong>description</strong>
modified (<a href="/ticket/16993?action=diff&version=9">diff</a>)
</li>
</ul>
TicketembrayTue, 26 Feb 2019 13:58:00 GMTstatus changed; resolution set
https://trac.sagemath.org/ticket/16993#comment:10
https://trac.sagemath.org/ticket/16993#comment:10
<ul>
<li><strong>status</strong>
changed from <em>positive_review</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>invalid</em>
</li>
</ul>
<p>
Presuming these are all correctly reviewed as either duplicate, invalid, or wontfix.
</p>
Ticket