Question: table of newton raphson

how to make a table of newton raphson ? 
working is below 
printf("No           root                   x[i+1]                 abs(x[i+1]-x[i])\n"); for i to n do y[i] := evalf(x[i]+(-D1(x[i])+sqrt(D1(x[i])^2-2*f(x[i])*D2(x[i])))/D2(x[i])); x[i+1] := evalf(y[i]-f(y[i])/sqrt(D1(x[i])^2-2*f(x[i])*D2(x[i]))); printf("%d         %10.10f     %10.10f       %10.10e \n", i+1, x[i+1], f(x[i+1]), abs(x[i+1]-x[i])); if abs(x[i+1]-x[i]) < tol then print("approximate solution" = x[i+1]); print("No of iterations" = i+1); break end if end do
please help me 

Please Wait...