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

Closed
opened this Issue Dec 23, 2015 · 2 comments

Projects
None yet
2 participants
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).

Merged

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```
``` edc5c96 ```
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).```
``` 935212a ```