GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm getting this undesired behavior in sympy
In : x = sy.var('x', real=True)
In : (1/x).subs(x**2,1)
Clearly, this should not be the case. Out should be 1/x. Am I missing something or is this a bug?
I think it should be 1 instead of 1/x. The first argument is the variable and the second is the substitution. So your substituting x when x2=1. If you try (1/x).subs(x2,4), you will get 1/2.
The problem is that when x**2=1 x can be either 1 or -1. The subs method is assuming x is positive.
More strict checking of the Pow._eval_power output
For now, we make sure that old.base wasn't changed.