New issue

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

Equality involving expression with known real part and 0 should evaluate #10304

Closed
smichr opened this Issue Dec 23, 2015 · 2 comments

Comments

Projects
None yet
2 participants
@smichr
Copy link
Member

smichr commented Dec 23, 2015

>>> d=S('-(3*2**pi)**(1/pi) + 2*3**(1/pi)')
>>> d.is_comparable
False
>>> e = 1 + d*I
>>> e.is_real  # can't tell unless we know d is nonzero...
>>> simplify(Eq(e,0))
Eq(1 + I*(-(3*2**pi)**(1/pi) + 2*3**(1/pi)), 0)

That final expression should be False since we know that the real part is non-zero (so it doesn't matter if we can't decide about the imaginary part).

@asmeurer

This comment has been minimized.

Copy link
Member

asmeurer commented Dec 23, 2015

You also need to know d.is_real (if d == I then e is 0).

skirpichev added a commit to diofant/diofant that referenced this issue Dec 23, 2015

Simplify Eq/Ne involving expression with known real part and 0
We just trust the answer of Expr.equals method.

Fixes sympy/sympy#10304
@smichr

This comment has been minimized.

Copy link
Member

smichr commented Dec 23, 2015

You also need to know d.is_real

good catch -- I'll check for that condition, too.

smichr added a commit to smichr/sympy that referenced this issue Dec 24, 2015

10304: edit Relational._eval_simplify
Also, add _eval_is_nonzero to Add to handle issue sympy#10304 where
an expression with a nonzero real part and a real imaginary part
is recognized as nonzero.

A recursive condition was uncovered in complexes.py. It was corrected
my making the test for AppliedUndef sooner (but not so soon that a
function that simplifies out of an exprssion after simplification
would cause the arg(expression) to not return something new) e.g.
2*x*(f(0) - 1) - 2*x*f(0) is independent of f(0).

@smichr smichr closed this in #10298 Jan 7, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment