Mul._eval_subs broken in a number of ways

19 views
Skip to first unread message

Andreas Klöckner

unread,
May 12, 2012, 11:34:34 PM5/12/12
to sy...@googlegroups.com
Hi all,

(Before I start--one question: Google Code bug tracker or Github bug tracker--which is the right one?)

I'm writing because I could use some expert help sorting through my findings in this bug:


I think I've diagnosed most of the things that *cause* the breakage, but the fix isn't obvious, because the code seems to assume things that then turn out to be untrue. The symptom is this:

>>> x = sp.Symbol("x")
>>> xx = -sp.I*x
>>> print xx._eval_subs(-x, sp.Symbol("y"))
y

The causes (as far as I was able to figure out) are:

- First, I.as_base_exp() returns (-1, 1/2). I doubt this is wise--see next point.

- breakup() within Mul._eval_subs() then adds up exponents of (-1), yielding (-1)**(3/2), which sympy justifiedly rejects as undefined.

- That error really never comes to pass, though, because Mul._eval_subs() throws away the coefficient (and all its powers) if it was able to multiplicatively_extract() them. Unfortunately, it assumes that the entire 'coefficient' is contained in the first arg of the Mul, which is untrue in this case.

Any help would be much appreciated.

Thanks,
Andreas

Sergiu Ivanov

unread,
May 13, 2012, 3:38:06 AM5/13/12
to sy...@googlegroups.com
On Sun, May 13, 2012 at 6:34 AM, Andreas Klöckner
<li...@informa.tiker.net> wrote:
>
> (Before I start--one question: Google Code bug tracker or Github bug
> tracker--which is the right one?)

SymPy Issues are generally managed on the Google Code bug tracker
(from what I know).

Sergiu

Andreas Klöckner

unread,
May 13, 2012, 4:11:01 PM5/13/12
to sy...@googlegroups.com
On Saturday, May 12, 2012 11:34:34 PM UTC-4, Andreas Klöckner wrote:
Any help would be much appreciated.

For reference, there seem to be a few more bugs affecting CSE in the presence of complex numbers. I'll post more when I've got them tracked down.

Andreas 
Reply all
Reply to author
Forward
0 new messages