On Sun, Jul 28, 2024 at 6:51 AM 'Animesh Shree' via sage-support <[email protected]> wrote: > > I was looking into this issue > > This throws error: > ----------------------------------------------------------------------------------------- > sage: R1.<x,y,z> = QQ[] > sage: p = (x^2 - y^2) * (x + y + z) > sage: S = QQ['z']['x,y'] > sage: try: > ....: S(p) > ....: except Exception as e: > ....: print(e) > x^3 + x^2*y - x*y^2 - y^3 is not a constant polynomial > > > But this passes > -------------------------------------------------------------------------------------------- > sage: R2.<z,x,y> = QQ[] > sage: p = (x^2 - y^2) * (x + y + z) > sage: S(p) > x^3 + x^2*y - x*y^2 - y^3 + z*x^2 + (-z)*y^2 > sage: > > > So the output of > p = R1.random_element() > S(p) and S(R2(p)) > should they be same or different ?
I don't know whether S(p), i.e. coersion of p into the ring S, should work for different monomial order, or one should explicitly use R1.change_ring You get lucky with S and R2, as this is the same order. I'd also be vary of using the same variable names for different rings: if you declare two rings, R1 amd R2, using the same variable, say, y, how does Sage supposed to know whether y is a member of R1, or a member of R2 (you can still use R1(y) and R2(y) to be explicit) HTH, Dima > > One reason to this behavior is the ordering of monomial. Ref1 > The 1st one hits the Ref1 but 2nd one don't. That leads to ConstantPolynomial > Error. > > On Sunday, July 28, 2024 at 3:42:28 AM UTC+5:30 Dima Pasechnik wrote: >> >> On Sat, Jul 27, 2024 at 9:59 PM 'Animesh Shree' via sage-support >> <[email protected]> wrote: >> > >> > I saw this behavior >> > >> > sage: R1.<x,y,z> = QQ[] >> > sage: R2.<z,x,y> = QQ[] # Rearrange variables of R1 >> > sage: R1 >> > Multivariate Polynomial Ring in x, y, z over Rational Field >> > sage: R2 >> > Multivariate Polynomial Ring in z, x, y over Rational Field >> > sage: R1 is R2 >> > False >> > sage: print(R1.gens(), R1.variable_names()) >> > (x, y, z) ('x', 'y', 'z') >> > sage: print(R2.gens(), R2.variable_names()) >> > (z, x, y) ('z', 'x', 'y') >> > sage: >> > >> > >> > It looks like the order in which we initiate the polynomials leads to >> > different polynomial spaces. I thought this should not be the case. >> > I got confused. Is it right or bug or intentional? >> >> It is by design. Multivariate polynomial rings come with monomial >> orders (https://en.wikipedia.org/wiki/Monomial_order) >> and in this case R1 and R1 have different monomial orders. >> Monomial orders are crucial for many algorithms operating on >> multivariate polynomial rings, their ideals, etc. >> >> Dima >> >> > >> > -- >> > You received this message because you are subscribed to the Google Groups >> > "sage-support" group. >> > To unsubscribe from this group and stop receiving emails from it, send an >> > email to [email protected]. >> > To view this discussion on the web visit >> > https://groups.google.com/d/msgid/sage-support/30b4f982-9b1a-434f-a512-7690b6c16e6bn%40googlegroups.com. > > -- > You received this message because you are subscribed to the Google Groups > "sage-support" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sage-support/f25ed01f-2b98-47bd-bb56-52a42ed19149n%40googlegroups.com. -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/CAAWYfq36zbYSM5mJuzjmmoofjYur%3D3fWxQOEg14W-2yKzhvZxw%40mail.gmail.com.
