sage: var("a, b, c") (a, b, c) sage: foo=(a-b)*(b-c) ; foo (a - b)*(b - c)
Note that : sage: foo.expand() a*b - b^2 - a*c + b*c >From foo.list? : Docstring: Return the coefficients of this symbolic expression as a polynomial in x. INPUT: * "x" -- optional variable. OUTPUT: A list of expressions where the "n"-th element is the coefficient of "x^n" when self is seen as polynomial in "x". Therefore : sage: foo.list() [-b^2 + b*c, b - c] Is indeed the list of foo’s coefficients of powers of a. What you seek is : sage: foo.operands() [a - b, b - c] HTH, BTW, a better forum or this kind of questions is probably ask.sagemath.org. Le lundi 23 octobre 2023 à 18:23:32 UTC+2, Rolandb a écrit : > Hi, > > I am surprised by the output (9.8 and 10.1 Ubuntu): > var('A,B,C') factor((A-B)*(B-C)).list() > var('A,B,C') factor((A-B)*(B-C)).list() > > var('A,B,C') > factor((A-B)*(B-C)).list() > [-B^2 + B*C, B - C] > > I expected [B - A, B - C]. Any explanation? > > Kind regards, > > Roland > -- 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 sage-support+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/a893adfb-7a84-46e0-8c8c-b8df8b357034n%40googlegroups.com.