Implemented newton.m