newton code