Minimization to find square root of a number