newton(f,df,z,eps):=
  do (w:rectform(f(z)/df(z)),z:rectform(z-w),
      if float(cabs(w))<eps then return(z));
f(z):=z^3-z+5$
df(_z):=''(diff(f(_z),_z))$                                                       n:3$
R:2.0$
pi:3.14$                                                                       eps:1.0e-15$
for k:1 thru n
  do (z: R*(cos(2*pi/n*k-pi/n)+%i*sin(2*pi/n*k-pi/n)),                               s:newton(f,df,z,eps), print(s))$
