Question: The method of simple iterations

Hello everybody!! Can you please help me figure it out. I wrote the code, but for some reason I have an infinite loop going on, it counts normally to the cycle, as the cycle reaches, then everything is infinite

restart;
with(plots):
f:=unapply(2*x-4*cos(x)-0.6,x); #the equation itself
f1:=unapply(diff(f(x),x),x); #its derivative
a:=-0.5; b:=1.5; eps:=0.001: #interval and accuracy
 
 
phi:=unapply((4*cos(x)-0.6)/2,x); #solving the equation with respect to x
x[0]:=1; #I take any point from the interval
x[1]:=evalf(phi(x[0]));
L:=evalf(abs(phi(b)-phi(a))/abs(b-a)); 
L1:=evalf(abs(phi(x[1])-phi(x[0]))/abs(x[1]-x[0])); 
psi:=unapply(abs(diff(phi(x),x)),x);
plot([psi(x),1],x=a..b,color=[red,green]);
 
n:=1:
while abs(evalf(x[n]-x[n-1])) > eps do
n:=n+1:
x[n]:=evalf(phi(x[n-1]));
od;
fsolve(f(x)=0,x=a..b);

 

Please Wait...