test the newton method