update the newton method