function x = stephensen(f,x0)
%Fixed point iteration with Aitken extrapolation
%Stephensen Method
maxit=100;
iter=0;
es=0.000001;
ea=1.1*es;
x=0;
while iter<maxit && ea>es
x1=f(x0);
x2=f(x1);
x=x0-(x1-x0)*(x1-x0)/(x2-2*x1+x0);
ea=abs(x-x0)*100.0;
x0=x;
iter=iter+1;
end
if iter>=maxit  fprintf('Maximum number of iteration is exceeded  result might not be valid');end
end
