filled in newtonNd.m