Status: Accepted
Owner: Vinzent.Steinberg
CC: smichr
Labels: Type-Defect Priority-Medium

New issue 1907 by Vinzent.Steinberg: Pow(..., evaluate=something) is broken
http://code.google.com/p/sympy/issues/detail?id=1907

In [11]: Add(Pow(y, 2, evaluate=True), Mul(-1, Pow(y, 2)))
Out[11]:
 2    2
y  - y

In [12]: Add(Pow(y, 2, evaluate=False), Mul(-1, Pow(y, 2)))
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)

/home/one/src/sympy/<ipython console> in <module>()

/home/one/src/sympy/sympy/core/cache.pyc in wrapper(*args, **kw_args)
     83         except KeyError:
     84             pass
---> 85         func_cache_it_cache[k] = r = func(*args, **kw_args)
     86         return r
     87

/home/one/src/sympy/sympy/core/operations.pyc in __new__(cls, *args,
**assumptions)
     29         if len(args)==1:
     30             return _sympify(args[0])
---> 31         c_part, nc_part, order_symbols = cls.flatten(map(_sympify,
args))
     32         if len(c_part) + len(nc_part) <= 1:
     33             if c_part: obj = c_part[0]

/home/one/src/sympy/sympy/core/add.pyc in flatten(cls, seq)
    108                     newseq.append(Mul(c,s))
    109
--> 110             noncommutative = noncommutative or not s.is_commutative
    111
    112         # nan


AttributeError: is_commutative

In [13]: Add(Pow(y, 2), Mul(-1, Pow(y, 2)))
Out[13]: 0

The exception has to be fixed and the first result is problematic. Please
note that expand() works.

--
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to