% Written by Rex Ford % Tell's if Newton's Method converges to root 1, 2 or 3. % root 1: -1 % 2: .5+i*3^0.5 % 3: -.5+i*3^0.5 function sol = newton(guess) tol=10^-12; %assignment's recommended tolerance f=@(x)x^3+1; %our function f_prime=@(x)3*x^2; %hand-computed derivative max_its=15; %in case there isn't convergence i=0; while i