We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7dc38eb commit a96e507Copy full SHA for a96e507
symengine/lib/symengine_wrapper.pyx
@@ -1502,6 +1502,14 @@ class Relational(Boolean):
1502
def is_Relational(self):
1503
return True
1504
1505
+ def __bool__(self):
1506
+ if len(self.free_symbols):
1507
+ # If there are any free symbols, then boolean evaluation is ambiguous in most cases. Throw a Type Error
1508
+ raise TypeError(f'Relational with free symbols cannot be cast as bool: {self}')
1509
+ else:
1510
+ simplification = self.simplify()
1511
+ return bool(simplification)
1512
+
1513
Rel = Relational
1514
1515
0 commit comments