Hello,
I have the following problem: I define a polynomial ring
R.<x,y> = PolynomialRing(QQ,2,order='deglex')
then I define a new polynomial ring, with an addition auxiliary variable and a polynomial in this ring
S = PolynomialRing(R.base(),['w1']+[str(v) for v in R.gens() ],order=TermOrder('lex',1)+R.term_order())
S.inject_variables(verbose=False)
f = w1*x^3 + w1*y + x^2 + y^2
then I define another polynomial ring, with another addition auxiliary variable. Coercing to this new ring works fine
T = PolynomialRing(S.base(),['w2']+[str(v) for v in S.gens() ],order=TermOrder('lex',1)+S.term_order())
f2 = T(f)
However the way backwards fails
S(f2)
(...) /home/phil/Applications/SageMath/local/lib/python2.7/site-packages/sage/rings/polynomial/polynomial_ring.pyc in _coerce_map_from_(self, P) 791 from sage.rings.polynomial.multi_polynomial_ring import is_MPolynomialRing 792 if is_MPolynomialRing(P) and self.variable_name() in P.variable_names(): --> 793 P_ = P.remove_var(self.variable_name()) 794 return self.base_ring()!=P_ and self.base_ring().has_coerce_map_from(P_) 795
/home/phil/Applications/SageMath/local/lib/python2.7/site-packages/sage/rings/polynomial/multi_polynomial_ring_base.pyx in sage.rings.polynomial.multi_polynomial_ring_base.MPolynomialRing_base.remove_var (build/cythonized/sage/rings/polynomial/multi_polynomial_ring_base.c:5831)() 299 return PolynomialRing(self.base_ring(), vars, order=self.term_order()) 300 except ValueError: --> 301 raise ValueError("impossible to use the original term order (most likely because it was a block order). Please specify the term order for the subring") 302 else: 303 return PolynomialRing(self.base_ring(), vars, order=order)
ValueError: impossible to use the original term order (most likely because it was a block order). Please specify the term order for the subring
Any ideas what I could do to prevent this problem? How would I specify the term order (as it was suggested)?
Kind regards, Philipp