Newton method to solve quadratic equations