-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
FiniteSet not Value False #20089
Labels
Comments
Hi! Can you please clarify the issue further? |
This is what I get with sympy 1.6.2: In [8]: A = FiniteSet(1, 2)
In [9]: B = FiniteSet(FiniteSet(1, 2), FiniteSet(1))
In [10]: A
Out[10]: {1, 2}
In [11]: B
Out[11]: {{1}, {1, 2}}
In [12]: A in B
Out[12]: True
In [15]: 1 in A
Out[15]: True
In [13]: print(A.issubset(B)) # should be False
None
In [14]: 1 in B # should be False
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-14-858aaa7d4c4d> in <module>
----> 1 1 in B
~/current/sympy/sympy/sympy/sets/sets.py in __contains__(self, other)
673 # x in y must evaluate to T or F; to entertain a None
674 # result with Set use y.contains(x)
--> 675 raise TypeError('did not evaluate to a bool: %r' % c)
676 return b
677
TypeError: did not evaluate to a bool: None These would evaluate correctly if In [11]: Eq(1, FiniteSet(1, 2))
Out[11]: 1 = {1, 2}
In [12]: Eq(1, FiniteSet(1))
Out[12]: 1 = {1} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A=FiniteSet(1,2)
B=(FiniteSet(1,2),FiniteSet(1))
{1} in A
AttributeError Traceback (most recent call last)
in ()
----> 1 {1} in A
/usr/lib/python3/dist-packages/sympy/sets/sets.py in contains(self, other)
577
578 def contains(self, other):
--> 579 symb = sympify(self.contains(other))
580 if not (symb is S.true or symb is S.false):
581 raise TypeError('contains did not evaluate to a bool: %r' % symb)
/usr/lib/python3/dist-packages/sympy/sets/sets.py in contains(self, other)
305 """
306 other = sympify(other, strict=True)
--> 307 ret = sympify(self._contains(other))
308 if ret is None:
309 ret = Contains(other, self, evaluate=False)
/usr/lib/python3/dist-packages/sympy/sets/sets.py in _contains(self, other)
2001 r = false
2002 for e in self._elements:
-> 2003 t = Eq(e, other, evaluate=True)
2004 if isinstance(t, Eq):
2005 t = t.simplify()
/usr/lib/python3/dist-packages/sympy/core/relational.py in new(cls, lhs, rhs, **options)
302 return r
303 if hasattr(rhs, '_eval_Eq'):
--> 304 r = rhs._eval_Eq(lhs)
305 if r is not None:
306 return r
/usr/lib/python3/dist-packages/sympy/sets/sets.py in _eval_Eq(self, other)
1899
1900 def _eval_Eq(self, other):
-> 1901 if not other.is_FiniteSet:
1902 if (other.is_Union or other.is_Complement or
1903 other.is_Intersection or other.is_Produ
The text was updated successfully, but these errors were encountered: