```
class Solution(object):
def isPerfectSquare(self, num):
"""
:type num: int
:rtype: bool
"""
if num < 0: return False
if num <= 1: return True
n = num/2 # start guessing using n = num/2
while n*n!= num:
inc = (num-n*n)/(2*n)
n += inc
if -1 <= inc <= 1: break
if n*n < num: n+=1
if n*n > num: n-=1
return n*n == num
```

f(x) = x^2 (find x that f(x) = num)

f'(x) = 2*x

start process with x = n (any positive number)

if f(x) != num, update x = x + (num - f(x))/f'(x) = x + (num - n^2)/(2n)