S.EmptySet.as_relational(x) -> ?

12 views
Skip to first unread message

Chris Smith

unread,
Oct 1, 2017, 11:42:50 PM10/1/17
to sympy
When solving an inequality that is true for all reals, e.g. `x**2 >= 0`, the relational (-oo < x) & (x < oo) is returned by `solve_univariate_inequality`. This is good because it enforces the condition that x be real: substitution of x with I, for example, will fail. But if the relationship is never true for any real numbers, S.EmptySet is returned and as a relational, this comes back as False. Should a relational like x > oo be returned instead?

```
>>> from sympy.abc import x
>>> S.Reals.as_relational(x)
(-oo < x) & (x < oo)
>>> S.EmptySet.as_relational(x)
False
>>> S.UniversalSet.as_relational(x)
True
```

Aaron Meurer

unread,
Oct 2, 2017, 12:04:48 AM10/2/17
to sy...@googlegroups.com
True and False seem the best. It could return something like 1 = 0, but that would just evaluate to False anyway. 

Aaron Meurer 

--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/e01580ef-40bc-4872-9d4d-bb2156507608%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Chris Smith

unread,
Oct 2, 2017, 5:53:23 AM10/2/17
to sympy
As long as x is generic, it seems like something like this would preserve the fidelity of original
```
>>> eq = x**2 < 0
>>> ans = Piecewise((False, Eq(im(x), 0)), (True, Eq(re(x), 0)), (x > oo, True))
```
The both are True or False at the same values of x and they both raise a TypeError if `x -> 2 + I`. Once an assumption is placed on x, like being real, this collapses to False as expected.
Reply all
Reply to author
Forward
0 new messages