exercise 1.40 cubic procedure for Newton's method