Comment #2 on issue 642 by wflynny: wrong answer from simplifying  
non-commutative symbols
http://code.google.com/p/sympy/issues/detail?id=642

It seems that simplify works. However, radsimp, collect and factor do not:

In [3]: x=s.Symbol('x',commutative=False)

In [4]: y=s.Symbol('y',commutative=False)

In [8]: x*y-y*x
Out[8]: x*y - y*x

In [9]: s.simplify(x*y-y*x)
Out[9]: -(y*x - x*y)

In [10]: s.radsimp(x*y-y*x)
Out[10]: 0

In [11]: s.collect(x*y-y*x,x)
Out[11]: 0

In [12]: s.factor(x*y-y*x)
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (33, 0))

---------------------------------------------------------------------------
SymbolsError                              Traceback (most recent call last)

C:\Documents and Settings\wflynn\My Documents\Python\<ipython console> in  
<module>()

C:\Python25\lib\site-packages\sympy\polys\factortools.pyc in factor(f,  
*symbols,
**flags)
      78             return f
      79
---> 80     coeff, factors = poly_factors(f, *symbols, **flags)
      81
      82     result = 1 # XXX: don't include coeff in the leading factor

C:\Python25\lib\site-packages\sympy\polys\factortools.pyc in poly_factors(f,
*symbols, **flags)
      18     """
      19     if not isinstance(f, Poly):
---> 20         f = Poly(f, *symbols)
      21     elif symbols:
      22         raise SymbolsError("Redundant symbols were given")

C:\Python25\lib\site-packages\sympy\polys\polynomial.pyc in __new__(cls,  
poly,
*symbols, **flags)
     311
     312         if any(not s.is_commutative for s in symbols):
--> 313             raise SymbolsError("Non-commutative symbols: %s" %  
(symbols,))
     314
     315         # { M1: c1, M2: c2, ... }

SymbolsError: Non-commutative symbols: (y, x)

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--

You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to sympy-iss...@googlegroups.com.
To unsubscribe from this group, send email to 
sympy-issues+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.


Reply via email to