Finding the zeros of the function with two methods