[Python-modules-team] Bug#644713: expand returns incorrect results for non-commutative symbols

Julian Taylor jtaylor.debian at googlemail.com
Sat Oct 8 11:52:52 UTC 2011


Package: sympy
Version: 0.6.7-1.1
Severity: normal
Tags: fixed-upstream

import sympy
print sympy.__version__
a, b = sympy.symbols(["a", "b"], real=False, commutative=False)
print ( (a-b)**2 ).expand(mul=True)
print ( (a-b)**3 ).expand(mul=True)

outputs
'0.6.7'
-a*b - b*a + a**2 + b**2
-a*b - b*a + a**2 + b**2

the result of (a-b)**3 is obviously incorrect.

This issue is fixed upstream and outputs the correct result:
'0.7.1'
-a*b + a**2 - b*a + b**2
-a*b*a + a*b**2 - a**2*b + a**3 + b*a*b - b*a**2 + b**2*a - b**3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/python-modules-team/attachments/20111008/ab0c5ed1/attachment.pgp>


More information about the Python-modules-team mailing list