Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

There is also a difference between the level of evaluation of the two expressions. The sage (man) sees 5-1, and thinks mayby it is better to write a 4 immediately, then seeing 4 == 0... and in the other case thinks, let it be as it comes...

If a True or a False is needed, then we have to require in the second case an explicit evaluation.

sage:  print 3^(1/3) - 3^(1/5) == 0
3^(1/3) - 3^(1/5) == 0
sage:  print bool( 3^(1/3) - 3^(1/5) == 0 )
False

Note also how the sage interpreter reshapes expressions in the following cases:

sage:  print 4 == 0
False
sage:  print 3^(1/5) - 3^(1/5) == 0
0 == 0
sage:  print bool( 3^(1/5) - 3^(1/5) ) == 0
True

sage:  print type( 3^(1/5) - 3^(1/5) )
<type 'sage.symbolic.expression.Expression'>
sage: print type(0)
<type 'sage.rings.integer.Integer'>

sage: print 98^(1/2) - 8^(1/6) == 5184^(1/4)
7*sqrt(2) - 8^(1/6) == 6*4^(1/4)
sage: print bool( 98^(1/2) - 8^(1/6) == 5184^(1/4) )
True

Note: This answer differs only psychologically from the above one. (Please let it above.)