r.du...@gmail.com
unread,Sep 4, 2017, 11:25:10 AM9/4/17Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sy...@googlegroups.com
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])