Added Newtons algorithm to find roots