Sage: Ticket #15865: Should there be a method on a rational function field that returns the ring it came from?
https://trac.sagemath.org/ticket/15865
<p>
If I have a fraction field, how do I find the ring whose fraction field it is? Note that, since a fraction field sometimes serves several base rings at the same time, this can mean:
</p>
<ul><li>the base ring from which the fraction field was constructed (possibly thread-unsafe?);
</li></ul><ul><li>a "canonical" base ring for which the fraction field can be constructed;
</li></ul><ul><li>or anything inbetween.
</li></ul><p>
I'm not sure which of these are feasible; I'd be happy with a method that returns me a polynomial ring if I apply it to the fraction field of said polynomial ring. There is the <code>_base</code> attribute which seems to give the base ring, but I'd prefer an exposed method.
</p>
<p>
I assume this also does the trick:
</p>
<pre class="wiki">sage: g = FractionField(PolynomialRing(QQ, ['x']))
sage: parent(g.zero().numerator())
Rational Field
</pre><p>
but it feels like a hack...
</p>
en-usSagehttps://trac.sagemath.org/chrome/site/logo_sagemath_trac.png
https://trac.sagemath.org/ticket/15865
Trac 1.1.6tscrimThu, 27 Feb 2014 01:33:21 GMT
https://trac.sagemath.org/ticket/15865#comment:1
https://trac.sagemath.org/ticket/15865#comment:1
<p>
There's the somewhat unclearly named <code>base()</code> method:
</p>
<pre class="wiki">sage: g = FractionField(QQ['x'])
sage: g.base()
Univariate Polynomial Ring in x over Rational Field
sage: g.base_ring()
Rational Field
</pre>
TicketdarijThu, 27 Feb 2014 01:41:24 GMT
https://trac.sagemath.org/ticket/15865#comment:2
https://trac.sagemath.org/ticket/15865#comment:2
<p>
Thanks! What about adding some doc like this:
</p>
<pre class="wiki">Return the base of ``self``.
This means a reasonable choice of a ring `R` such that
``self`` is the fraction field of ``self``. For instance,
if ``self`` is the fraction field of a polynomial ring,
then ``self.base()`` is said polynomial ring (as opposed
to ``self.base_ring()``, which is the base ring over
which the polynomial ring is defined).
.. WARNING::
This might not be the ring *you* used to construct
``self``. For instance:
sage: QQ.base() # not ZZ
Rational Field
sage: Frac(Frac(PolynomialRing(QQ, 'x'))).base()
Univariate Polynomial Ring in x over Rational Field
</pre><p>
(Note that it is not the parent of self.zero().numerator()...)
</p>
TickettscrimThu, 27 Feb 2014 01:53:19 GMT
https://trac.sagemath.org/ticket/15865#comment:3
https://trac.sagemath.org/ticket/15865#comment:3
<p>
Hmm....I think we maybe should have a more clearly named method such as <code>fraction_field_base()</code> for all fraction fields. Oh also I remembered:
</p>
<pre class="wiki">sage: g = FractionField(QQ['x'])
sage: g.construction()
(FractionField, Univariate Polynomial Ring in x over Rational Field)
</pre><p>
Although on another ticket we decided to have the fraction field of Laurent polynomials be the fraction field of usual polynomials (I forget the number currently, but I can find it if you want). I think this is the right thing to do FTR. Hence we should not expect to have <code>FF(R).base() == R</code> in general. Moreover, I think <code>QQ.fraction_field_base()</code> should be <code>ZZ</code>. Although perhaps not <code>base()</code>, but that would definitely need a sage-devel discussion.
</p>
Ticket