[sage-devel] Re: Something.expand() is 0 but factor() is not zero

2022-04-03 Thread dmo...@deductivepress.ca
I think this is indeed a bug, so thanks for reporting it. My impression from a quick look at the code is that sagemath expands the expression into a polynomial (a linear combination of monomials) before trying to factor it. If the expansion has only a single term (a constant times a monomial),

[sage-devel] Re: Something.expand() is 0 but factor() is not zero

2022-04-03 Thread a.simpl...@gmail.com
I meant to say that f.expand() gives the correct answer. To see why, factor out the common factors (x-y)(y-z)(z-x). Once you did so, the rest is ( (x-y) + (y-z) + (z-x) ) and so I expect f.factor() returns 0. The statement "the given expression cannot be factorized further" seems weird to me. --

[sage-devel] Re: Something.expand() is 0 but factor() is not zero

2022-04-03 Thread Emmanuel Charpentier
sage: var("x, y, z") (x, y, z) sage: Ex = (x-y)^2*(y-z)*(z-x) + (y-z)^2*(z-x)*(x-y) + (z-x)^2*(x-y)*(y-z) sage: Ex -(x - y)^2*(x - z)*(y - z) + (x - y)*(x - z)^2*(y - z) - (x - y)*(x - z)*(y - z)^2 sage: Ex.expand() 0 sage: Ex.factor() -(x - y)^2*(x - z)*(y - z) + (x - y)*(x - z)^2*(y - z) - (x

[sage-devel] Re: Something.expand() is 0 but factor() is not zero

2022-04-03 Thread Adarsh Kishore
I checked this on my SageMath v9.6.beta5 on Ubuntu 20.04 LTS, and it checks out [image: Screenshot from 2022-04-03 14-58-46.png] On Sunday, April 3, 2022 at 2:57:35 PM UTC+5:30 Adarsh Kishore wrote: > By the way, f.expand() is not wrong. The expression is identically equal > to 0 for all value

[sage-devel] Re: Something.expand() is 0 but factor() is not zero

2022-04-03 Thread Adarsh Kishore
Which version of Sage are you using? And on which platform? On Sunday, April 3, 2022 at 10:44:59 AM UTC+5:30 a.simpl...@gmail.com wrote: > The following code > > > var("z y z") > > f = (x-y)^2*(y-z)*(z-x) + (y-z)^2*(z-x)*(x-y) + (z-x)^2*(x-y)*(y-z) > > f.expand() > > outputs 0. > But > > f.factor