added some methods for newtons method