Opened 5 years ago

Last modified 5 years ago

#15865 new defect

Should there be a method on a rational function field that returns the ring it came from?

Reported by: darij Owned by:
Priority: major Milestone:
Component: algebra Keywords: polynomials, fraction field, categories
Cc: tscrim, sage-combinat Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

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:

  • the base ring from which the fraction field was constructed (possibly thread-unsafe?);
  • a "canonical" base ring for which the fraction field can be constructed;
  • or anything inbetween.

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 _base attribute which seems to give the base ring, but I'd prefer an exposed method.

I assume this also does the trick:

sage: g = FractionField(PolynomialRing(QQ, ['x']))
sage: parent(g.zero().numerator())
Rational Field

but it feels like a hack...

Change History (3)

comment:1 Changed 5 years ago by tscrim

There's the somewhat unclearly named base() method:

sage: g = FractionField(QQ['x'])
sage: g.base()
Univariate Polynomial Ring in x over Rational Field
sage: g.base_ring()
Rational Field

comment:2 Changed 5 years ago by darij

Thanks! What about adding some doc like this:

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

(Note that it is not the parent of self.zero().numerator()...)

Last edited 5 years ago by darij (previous) (diff)

comment:3 Changed 5 years ago by tscrim

Hmm....I think we maybe should have a more clearly named method such as fraction_field_base() for all fraction fields. Oh also I remembered:

sage: g = FractionField(QQ['x'])
sage: g.construction()
(FractionField, Univariate Polynomial Ring in x over Rational Field)

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 FF(R).base() == R in general. Moreover, I think QQ.fraction_field_base() should be ZZ. Although perhaps not base(), but that would definitely need a sage-devel discussion.

Note: See TracTickets for help on using tickets.