newtons method in sage