Processing math: 100%

First time here? Check out the FAQ!

Ask Your Question
2

Change degree in InfinitePolynomialRing

asked 6 years ago

heluani gravatar image

updated 0 years ago

FrédéricC gravatar image

If I use

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

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

z0<z1<z2<...<y0<y1<...<x0<x1<...

And each variable having degree 1. I would like to obtain something like 'deglex' but assigning degree n to xn,yn,zn so that in particular I would obtain

z0<y0<x0<z1<y1<x1<...

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.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 5 years ago

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

Preview: (hide)
link

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: 6 years ago

Seen: 579 times

Last updated: Sep 03 '19