The "==" operator for symbolics creates a new symbolic expression:
sage: hr=(x^2+2*x+1) sage: hl=(x+1)^2 sage: E = hr == hl sage: E x^2 + 2*x + 1 == (x + 1)^2 sage: type(E) <class 'sage.symbolic.expression.Expression'> To check if the two expressions are actually the same, I think you can use the "is" statement: sage: f = x + 1 sage: g = x^2 + x + 1 sage: f is g False sage: f is f True sage g is g True Le jeudi 11 août 2022 à 09:56:06 UTC-4, Ralf Hemmecke a écrit : > Am I doing something wrong? I would have expected the last line to > return False. > > ┌────────────────────────────────────────────────────────────────────┐ > │ SageMath version 9.6, Release Date: 2022-05-15 │ > │ Using Python 3.10.4. Type "help()" for help. │ > └────────────────────────────────────────────────────────────────────┘ > sage: hr=(x^2+2*x+1) > sage: hl=(x+1)^2 > sage: bool(hl==hr) > True > sage: bool(hl!=hr) > True > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/650d087f-69e0-4745-9484-468fd11c3c7dn%40googlegroups.com.