# Revision history [back]

The difference you noticed comes from the fact that 5 and 3^(1/3) are different objects

sage: parent(5)
Integer Ring
sage: parent(3^(1/3))
Symbolic Ring


Comparisons between integers (and more generally rationals) is very different from comparisons between symbolic elements. In order to test x^y == s^t you would better assume that bot y and t are integers (that you can always do by taken appropriate powers). Assuming that you only care about positive numbers you can use

def test_equality(x, y, s, t):
m = lcm(y.denominator(), t.denominator())
return x^(y*m) == s^(t*m)


The difference you noticed comes from the fact that 5 and 3^(1/3) are have different objectsnatures

sage: parent(5)
Integer Ring
sage: parent(3^(1/3))
Symbolic Ring


Comparisons between integers (and more generally rationals) is very different from comparisons between symbolic elements. In order to test x^y == s^t you would better assume that bot y and t are integers (that you can always do by taken appropriate powers). Assuming that you only care about positive numbers you can use

def test_equality(x, y, s, t):
m = lcm(y.denominator(), t.denominator())
return x^(y*m) == s^(t*m)