# cuberoot.py
# Lillian Lee (LJL2)
# April 8, 2014

"""Take cube root of input argument,
printing diagnostic info as well"""

import sys

def cuberoot(c):
    """Returns: x s.t. x*x*x is c
    Tolerance for 'equality':  1e-6"""
    pass
    # BEGIN REMOVE 
    x = c/3.0
    while abs(x*x*x - c) > 1e-6:
        x = x - (x*x*x -c)/(3*x*x)
        print x
    return x
    # END REMOVE

if __name__ == '__main__':


    if len(sys.argv) == 1:
        print 'Usage: python cuberoot.py n'
    else:
        x = cuberoot(float(sys.argv[1]))
        print 'cube root is supposedly', x
        print 'verifying x*x*x', x*x*x