Newton's method
Algorithm using Newton's method.