Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

For what it's worth, you can force degree(x_n) = n+1 with the patch


--- /usr/lib/python2.7/site-packages/sage/rings/polynomial/infinite_polynomial_ring.py.bak  2019-09-03 09:24:46.299916008 -0300
+++ /usr/lib/python2.7/site-packages/sage/rings/polynomial/infinite_polynomial_ring.py  2019-09-03 09:42:00.063223890 -0300
@@ -993,8 +993,12 @@
         except ValueError:
             raise ValueError("Can't convert %s into an element of %s; the variables aren't admissible"%(x,self))

+        from sage.rings.integer import Integer
+
+        DegList = [Integer(s.split('_')[1])+1 for s in VarList]
         from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
-        R = PolynomialRing(self._base, VarList, order=self._order)
+        from sage.rings.polynomial.term_order import TermOrder
+        R = PolynomialRing(self._base, VarList, order=TermOrder(self._order,DegList))
         if isinstance(R, MPolynomialRing_libsingular) and isinstance(x,MPolynomial_libsingular): # everything else is so buggy that it's even not worth to try.
             try:
                 # Problem: If there is only a partial overlap in the variables
@@ -1449,8 +1453,11 @@
                 raise IndexError("Variable index is too big - consider using the sparse implementation")
             names = reduce(operator.add, names)
             names.sort(key=P.varname_key, reverse=True)
+            from sage.rings.integer import Integer
+            DegList = [Integer(s.split('_')[1])+1 for s in names]
             #Create the new polynomial ring
-            P._P = PolynomialRing(P.base_ring(), names, order = P._order)
+            from sage.rings.polynomial.term_order import TermOrder
+            P._P = PolynomialRing(P.base_ring(), names, order = TermOrder(P._order, DegList))
             ##Get the generators
             P._max = i
             #return InfinitePolynomial_dense(P, P._P.gen(P._P.variable_names().index(self._name+'_'+str(i))))

I opened a ticket in https://trac.sagemath.org/ticket/28452