ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 26 Feb 2019 05:15:45 -0600coercion between polynomial rings with block term ordershttp://ask.sagemath.org/question/45553/coercion-between-polynomial-rings-with-block-term-orders/ 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,
PhilippPhilipp SchneiderTue, 26 Feb 2019 05:15:45 -0600http://ask.sagemath.org/question/45553/How can I print equations just like latex?http://ask.sagemath.org/question/25820/how-can-i-print-equations-just-like-latex/Now I'm testing several equations and solutions with Sage. After testing the solutions, I'd present it to the group members. But I met a problem to print the equations.
For example, when I write the code.
sage: z(x)=6/(5*pi*50*(x^2+25))*exp((-x+sqrt(x^2+25))/50)
sage: view (z)
Then the sage doesn't show the equation that is exactly same with the code, but it just shows simplified form. Could anyone let me know how to show the original equation?
And it would be also appreciated, if you tell me how to modify the simplifying mechanism. I'd love to write equations that don't contain any large denominators with many exponential terms.
thank you.NownuriFri, 13 Feb 2015 01:34:10 -0600http://ask.sagemath.org/question/25820/monomial orders in Laurent polynomialshttp://ask.sagemath.org/question/25411/monomial-orders-in-laurent-polynomials/ in Sage you can compare Laurent polynomials using a specified monomial order, one of the following standard ones: lex, grlex, invergrlex etc.
does anyone know how these monomial orders are defined for Laurent polynomials? are they well-orders too?marcin.szalskiTue, 06 Jan 2015 05:05:24 -0600http://ask.sagemath.org/question/25411/Polynomial in $GF(p^2)$http://ask.sagemath.org/question/23920/polynomial-in-gfp2/Hello, I have a finite field $K=GF(p^2)$ and the polynomial ring $R=K[x,y]$. They are defined as such
p = 11;
K = GF(p^2,'t');
K.inject_variables();
R.<e1,e2> = K[];
f = (-4*t + 3)*e1*e2 + (2*t + 4)*e2^2 + (2*t - 4)*e1 + (-5*t + 3)
I would like to know if it is possible to group/order all the terms with respect to `t` instead of `e1` and `e2`. That is, I would like to see
g = -4*e1*e2 + 2*e2^2 + 2*e1 - 5;
h = 3*e1*e2 + 4e2^2 + 4*e1 + 3;
such that
g*t + h == f
Thanks for your help!BlackadderMon, 25 Aug 2014 03:03:34 -0500http://ask.sagemath.org/question/23920/can sage stop ordering terms?http://ask.sagemath.org/question/10641/can-sage-stop-ordering-terms/Noob question incoming...
> sage: var('A B C x y')
(A, B, C, x, y)
sage: y == (C - A*x) / B
y == -(A*x - C)/B
What I would like/expect to get here is `y == (C - Ax)/B`. Is there a way to tell Sage to stop ordering terms?
Rationale - the expression ultimately goes to `latex()` and I'd like to be able to control how the result looks like.frnhrThu, 24 Oct 2013 01:58:50 -0500http://ask.sagemath.org/question/10641/affine varietyhttp://ask.sagemath.org/question/9889/affine-variety/Hi!
Do you know in a given polynomial with a term order like `grevlex`, how can I distinct $y>z>x$ insted of $x>y>z$ in sage?NedaThu, 07 Mar 2013 02:56:29 -0600http://ask.sagemath.org/question/9889/How to add term order to free module?http://ask.sagemath.org/question/7809/how-to-add-term-order-to-free-module/I am working with a free module over a ring of polynomials, and need more than what's available in FreeModule. To be specific, I want to define an order on the terms in the module (think term orders for Grobner bases), and then to be able to obtain leading monomials of module elements.
I tried to augment sage.modules.free_module_element.FreeModuleElement.__bases__ with my own mix-in as described in the tutorial, but apparently FreeModuleElement cannot be augmented in this way.
Presumably I could also put together derived classes for FreeModule and FreeModuleElement, but I'm somewhat up in the air as how to do this.
I considered augmenting my ring of polynomials with extra variables as a back-door way to produce my free module, but the term orders available in polynomial rings are not general enough for my application.
Any suggestions? So far I have worked around the problem, but it's ugly.Jeff StroomerSun, 12 Dec 2010 11:51:06 -0600http://ask.sagemath.org/question/7809/