Comment #5 on issue 2081 by asmeurer: Pow substitution introduces wrong answers
http://code.google.com/p/sympy/issues/detail?id=2081

This is the change I made by the way:


diff --git a/sympy/core/power.py b/sympy/core/power.py
index c121f45..e93c4b3 100644
--- a/sympy/core/power.py
+++ b/sympy/core/power.py
@@ -205,11 +205,13 @@ def _eval_subs(self, old, new):
         if old.func is self.func and self.base == old.base:
             coeff1, terms1 = self.exp.as_coeff_terms()
             coeff2, terms2 = old.exp.as_coeff_terms()
- if terms1==terms2: return new ** (coeff1/coeff2) # (x**(2*y)).subs(x**(3*y),z) -> z**(2/3*y) + if terms1==terms2 and coeff1.is_integer and coeff2.is_integer and (coeff1/coeff2).is_integer: + return new ** (coeff1/coeff2) # (x**(2*y)).subs(x**(3*y),z) -> z**(2/3*y)
         if old.func is C.exp:
             coeff1,terms1 = old.args[0].as_coeff_terms()
             coeff2,terms2 = (self.exp * C.log(self.base)).as_coeff_terms()
- if terms1==terms2: return new ** (coeff1/coeff2) # (x**(2*y)).subs(exp(3*y*log(x)),z) -> z**(2/3*y) + if terms1==terms2 and coeff1.is_integer and coeff2.is_integer and (coeff1/coeff2).is_integer: + return new ** (coeff1/coeff2) # (x**(2*y)).subs(exp(3*y*log(x)),z) -> z**(2/3*y) return self.base._eval_subs(old, new) ** self.exp._eval_subs(old, new)

     def as_powers_dict(self):


--
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