Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You can use bool() :

sage: bool(pi > 0)

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