I have written the Mann iteration's code for the mapping $\frac{z}{1+z^2}$, in Mathematica, but it is very slow. In fact it needs more than 200 seconds for obtaining 17th iteration, while Matlab does 100 iterations of the the Mann iteration in a second. Would you please tell me what is wrong with my code?
Clear[x, z, n, lambda, f]
For[n = 1; x[1] := 1;
lambda := 1/2; f[z_] := z/(1 + z^2), n < 21, n++,
x[n_] := (1 - lambda) x[n - 1] + lambda f[x[n - 1]]; Print[Timing[N[x[n]]]]]
