Esempio n. 1
0
def square(x):
    """checks if x is a square number"""
    sq = root(x, 2)
    if sq.is_integer():
        return True
    else:
        return False
Esempio n. 2
0
def cube(x):
    """
    Checks if X is a cube number
    :param x:
    :return:

    >>> cube(2)
    False
    >>> cube(9)
    False
    >>> cube(8)
    True
    """
    c = root(x, 3)
    if float.is_integer(c):
        return True
    else:
        return False
Esempio n. 3
0
 def __rpow__(self, other, modulo=None):
     from amath.Computation.power import root
     return pow(root(other, self.denominator), self.numerator)
Esempio n. 4
0
 def __rpow__(self, other, modulo=None):
     from amath.Computation.power import root
     return pow(root(other, self.denominator), self.numerator)