% secant method
x0=-1;
x1=2;
x2=x1-f(x1)*(x1-x0)/(f(x1)-f(x0));        
n=1;
   while (abs(x1-x0)>=1.0e-15) & (n<=1000000)     
     x0=x1;
     x1=x2;                                       
     x2=x1-f(x1)*(x1-x0)/(f(x1)-f(x0));
     n=n+1;
   end
y=x2
n