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