Yes, there are other problems with non-commutative things, like
https://github.com/sympy/sympy/issues/12576#issuecomment-308384814 or
https://github.com/sympy/sympy/issues/12258. It feels like non-commutative
symbols weren't originally planned and when they were introduced, not all
of the existing algorithms were changed to account for them. Or maybe the
reason is that when those algorithms were being written, the authors forgot
about non-commutativity. Hard to say, but something should be done about
it. Could you open an issue if you haven't already done so?
On Monday, 4 September 2017 18:25:10 UTC+3, ric wrote:
>
> Hello
>
> I'm playing with SympyLive and it seems to me that the commutative=False
> assumption is not honored by some functions, resulting in wrong results.
>
> Example: When A and b are non-commuting symbols
>
> factor(A**2+B**2+2*A*B) gives (A+B)**2 but it should do nothing i.e.
> A**2+B**2+2*A*B
>
> and itermonomials should give also the B*A monomial. Or at list they
> should refuse to answer when some variables are not commuting.
>
> Hope this helps
> ric
>
> #############################
> Python console for SymPy 1.0 (Python 2.7.12)
>
> These commands were executed:
> >>> from __future__ import division
> >>> from sympy import *
> >>> x, y, z, t = symbols('x y z t')
> >>> k, m, n = symbols('k m n', integer=True)
> >>> f, g, h = symbols('f g h', cls=Function)
>
> >>> from sympy.polys.orderings import *
> >>> from sympy.polys.monomials import *
> >>> A, B = symbols('A,B',commutative=False)
> >>> A.is_commutative
> False
> >>> A*B-B*A ## does nothing: OK
> A*B - B*A
> >>> factor(A**2+B**2+2*A*B) ## wrong result
> (A + B)**2
> >>> itermonomials([A,B], 2)) ## wrong result
> set([1, A, A**2, B, B**2, A*B])
>
>
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/1d3c4817-ea9b-479f-b09f-263b4468d791%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.