@@ -41,10 +41,11 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing):
41
41
42
42
sage: R.<x,y> = ZZ['x,y']; R
43
43
Multivariate Polynomial Ring in x, y over Integer Ring
44
- sage: class CR(CommutativeRing):
44
+ sage: cat = Rings().Commutative()
45
+ sage: class CR(Parent):
45
46
....: def __init__(self):
46
- ....: CommutativeRing .__init__(self,self)
47
- ....: def __call__(self,x):
47
+ ....: Parent .__init__(self, self, category=cat )
48
+ ....: def __call__(self, x):
48
49
....: return None
49
50
sage: cr = CR()
50
51
sage: cr.is_commutative()
@@ -668,7 +669,7 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing):
668
669
669
670
def repr_long (self ):
670
671
"""
671
- Return structured string representation of self.
672
+ Return structured string representation of `` self`` .
672
673
673
674
EXAMPLES::
674
675
@@ -758,7 +759,6 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing):
758
759
Order: Graded Reverse Lexicographical
759
760
Variables: T, W
760
761
761
-
762
762
sage: # optional - magma
763
763
sage: magma(PolynomialRing(GF(7),4, 'x'))
764
764
Polynomial ring of rank 4 over GF(7)
@@ -868,12 +868,12 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing):
868
868
869
869
def gen (self , n = 0 ):
870
870
if n < 0 or n >= self ._ngens:
871
- raise ValueError (" Generator not defined. " )
871
+ raise ValueError (" generator not defined" )
872
872
return self ._gens[int (n)]
873
873
874
874
def variable_names_recursive (self , depth = sage.rings.infinity.infinity):
875
875
r """
876
- Returns the list of variable names of this and its base rings, as if
876
+ Return the list of variable names of this and its base rings, as if
877
877
it were a single multi-variate polynomial.
878
878
879
879
EXAMPLES::
@@ -883,7 +883,6 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing):
883
883
( 'x', 'y', 'z', 'w')
884
884
sage: R. variable_names_recursive( 3)
885
885
( 'y', 'z', 'w')
886
-
887
886
"""
888
887
if depth <= 0 :
889
888
all = ()
@@ -901,7 +900,8 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing):
901
900
902
901
def _mpoly_base_ring (self , vars = None ):
903
902
"""
904
- Returns the base ring if this is viewed as a polynomial ring over vars.
903
+ Return the base ring if this is viewed as a polynomial ring over vars.
904
+
905
905
See also MPolynomial._mpoly_dict_recursive.
906
906
"""
907
907
if vars is None :
@@ -1015,10 +1015,7 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing):
1015
1015
if not comb:
1016
1016
return (d,)
1017
1017
monomial = [comb[0 ]]
1018
- res = []
1019
- for j in range (n - 2 ):
1020
- res.append(comb[j + 1 ] - comb[j] - 1 )
1021
- monomial += res
1018
+ monomial.extend(comb[j + 1 ] - comb[j] - 1 for j in range (n - 2 ))
1022
1019
monomial.append(n + d - 1 - comb[- 1 ] - 1 )
1023
1020
return tuple (monomial)
1024
1021
@@ -1234,7 +1231,6 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing):
1234
1231
True
1235
1232
sage: R.random_element().parent() == R
1236
1233
True
1237
-
1238
1234
"""
1239
1235
k = self .base_ring()
1240
1236
n = self .ngens()
@@ -1243,7 +1239,7 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing):
1243
1239
1244
1240
# Note that 'terms' could be None while 'total' is a
1245
1241
# nonnegative integer, so the comparison 'terms > total' could
1246
- # fail in Python 3.
1242
+ # fail
1247
1243
if terms and terms > total:
1248
1244
terms = total
1249
1245
@@ -1526,13 +1522,14 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing):
1526
1522
1527
1523
def macaulay_resultant (self , *args , **kwds ):
1528
1524
r """
1529
- This is an implementation of the Macaulay resultant. It computes
1530
- the resultant of universal polynomials as well as polynomials
1531
- with constant coefficients. This is a project done in
1532
- sage days 55. It's based on the implementation in Maple by
1533
- Manfred Minimair, which in turn is based on the references listed below:
1534
- It calculates the Macaulay resultant for a list of polynomials,
1535
- up to sign!
1525
+ Return the Macaulay resultant.
1526
+
1527
+ This computes the resultant of universal polynomials as well as
1528
+ polynomials with constant coefficients. This is a project done
1529
+ in sage days 55. It is based on the implementation in Maple by
1530
+ Manfred Minimair, which in turn is based on the references
1531
+ listed below. It calculates the Macaulay resultant for a list
1532
+ of polynomials, up to sign!
1536
1533
1537
1534
REFERENCES:
1538
1535
@@ -1562,6 +1559,7 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing):
1562
1559
- the Macaulay resultant, an element of the base ring of ``self``
1563
1560
1564
1561
.. TODO::
1562
+
1565
1563
Working with sparse matrices should usually give faster results,
1566
1564
but with the current implementation it actually works slower.
1567
1565
There should be a way to improve performance with regards to this.
@@ -1684,7 +1682,7 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing):
1684
1682
else :
1685
1683
flist = args
1686
1684
1687
- if len (flist) < = 0 :
1685
+ if len (flist) = = 0 :
1688
1686
raise TypeError (' input list should contain at least 1 polynomial' )
1689
1687
if not all (f.is_homogeneous() for f in flist):
1690
1688
raise TypeError (' resultant for non-homogeneous polynomials is not supported' )
0 commit comments