1 | initial version |
You can use bool()
:
sage: bool(pi > 0)
True
Sage's evaluation model is the same as Python's. The above example is not actually lazily evaluated, when you evaluate pi > 0
, it immediately makes a call like the following:
sage: pi.__gt__(0)
pi > 0
Instead of returning True
or False
it instead returns symbolic expression representing the inequality. This is done for symbolic expressions to be consistent with things like
sage: x > 2
x > 2
Also, notice that it is specific to symbolic expressions:
sage: SR(2) == 2
2 == 2
sage: 2 == 2
True