Ask Your Question
2

Change degree in InfinitePolynomialRing

asked 2018-10-24 12:38:41 -0500

heluani gravatar image

If I use

 P.<x,y,z> = InfinitePolynomialRing(QQ)

Assuming any of the orderings 'lex, deglex, degrevlex' I will have

$z_0 < z_1 < z_2 < ... < y_0 < y_1 < ... < x_0 < x_1 < ...$

And each variable having degree 1. I would like to obtain something like 'deglex' but assigning degree $n$ to $x_n,y_n,z_n$ so that in particular I would obtain

$z_0 < y_0 < x_0 < z_1 < y_1 < x_1 < ... $

Is there a way to implement this. It seems that in order to compute Grobner bases on arc schemes these orderings are much more natural that the ones implemented, but I just started looking at Sage so I may have missed the right implementation of polynomial rings in infinitely many variables to work.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2019-09-03 08:00:03 -0500

heluani gravatar image

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

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-10-24 12:38:41 -0500

Seen: 248 times

Last updated: Sep 03