Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
src/sage/rings/ring.pyx: Remove methods duplicated from category
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Sep 2, 2022
1 parent cae9ee5 commit ccc1f85
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 72 deletions.
50 changes: 48 additions & 2 deletions src/sage/categories/rings.py
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,16 @@ def quo(self, I, names=None, **kwds):
[0 1]
)
A test with a subclass of :class:`~sage.rings.ring.Ring`::
sage: R.<x,y> = PolynomialRing(QQ,2)
sage: S.<a,b> = R.quo((x^2, y))
sage: S
Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x^2, y)
sage: S.gens()
(a, 0)
sage: a == b
False
"""
return self.quotient(I,names=names,**kwds)

Expand All @@ -875,7 +885,22 @@ def quotient_ring(self, I, names=None, **kwds):
NOTE:
This is a synonyme for :meth:`quotient`.
This is a synonym for :meth:`quotient`.
INPUT:
- ``I`` -- an ideal of `R`
- ``names`` -- (optional) names of the generators of the quotient. (If
there are multiple generators, you can specify a single character
string and the generators are named in sequence starting with 0.)
- further named arguments that may be passed to the quotient ring
constructor.
OUTPUT:
- ``R/I`` -- the quotient ring of `R` by the ideal `I`
EXAMPLES::
Expand Down Expand Up @@ -906,8 +931,24 @@ def quotient_ring(self, I, names=None, **kwds):
[0 1]
)
A test with a subclass of :class:`~sage.rings.ring.Ring`::
sage: R.<x> = PolynomialRing(ZZ)
sage: I = R.ideal([4 + 3*x + x^2, 1 + x^2])
sage: S = R.quotient_ring(I, 'a')
sage: S.gens()
(a,)
sage: R.<x,y> = PolynomialRing(QQ,2)
sage: S.<a,b> = R.quotient_ring((x^2, y))
sage: S
Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x^2, y)
sage: S.gens()
(a, 0)
sage: a == b
False
"""
return self.quotient(I,names=names, **kwds)
return self.quotient(I, names=names, **kwds)

def __truediv__(self, I):
"""
Expand All @@ -923,6 +964,11 @@ def __truediv__(self, I):
Traceback (most recent call last):
...
TypeError: Use self.quo(I) or self.quotient(I) to construct the quotient ring.
sage: QQ['x'] / ZZ
Traceback (most recent call last):
...
TypeError: Use self.quo(I) or self.quotient(I) to construct the quotient ring.
"""
raise TypeError("Use self.quo(I) or self.quotient(I) to construct the quotient ring.")

Expand Down
70 changes: 0 additions & 70 deletions src/sage/rings/ring.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -650,76 +650,6 @@ cdef class Ring(ParentWithGens):
import sage.rings.quotient_ring
return sage.rings.quotient_ring.QuotientRing(self, I, names=names, **kwds)

def quo(self, I, names=None, **kwds):
"""
Create the quotient of `R` by the ideal `I`. This is a synonym for :meth:`.quotient`
EXAMPLES::
sage: R.<x,y> = PolynomialRing(QQ,2)
sage: S.<a,b> = R.quo((x^2, y))
sage: S
Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x^2, y)
sage: S.gens()
(a, 0)
sage: a == b
False
"""
return self.quotient(I, names=names, **kwds)

def __truediv__(self, I):
"""
Dividing one ring by another is not supported because there is no good
way to specify generator names.
EXAMPLES::
sage: QQ['x'] / ZZ
Traceback (most recent call last):
...
TypeError: Use self.quo(I) or self.quotient(I) to construct the quotient ring.
"""
raise TypeError("Use self.quo(I) or self.quotient(I) to construct the quotient ring.")

def quotient_ring(self, I, names=None, **kwds):
"""
Return the quotient of self by the ideal `I` of ``self``.
(Synonym for ``self.quotient(I)``.)
INPUT:
- ``I`` -- an ideal of `R`
- ``names`` -- (optional) names of the generators of the quotient. (If
there are multiple generators, you can specify a single character
string and the generators are named in sequence starting with 0.)
- further named arguments that may be passed to the quotient ring
constructor.
OUTPUT:
- ``R/I`` -- the quotient ring of `R` by the ideal `I`
EXAMPLES::
sage: R.<x> = PolynomialRing(ZZ)
sage: I = R.ideal([4 + 3*x + x^2, 1 + x^2])
sage: S = R.quotient_ring(I, 'a')
sage: S.gens()
(a,)
sage: R.<x,y> = PolynomialRing(QQ,2)
sage: S.<a,b> = R.quotient_ring((x^2, y))
sage: S
Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x^2, y)
sage: S.gens()
(a, 0)
sage: a == b
False
"""
return self.quotient(I, names, **kwds)

def zero(self):
"""
Return the zero element of this ring (cached).
Expand Down

0 comments on commit ccc1f85

Please sign in to comment.