function regulafalsi(x,y,Niter,tol)
  disp("")
  disp ("Output for the Regula Falsi method")
  disp("")
  disp ("           n           a           b          x         f(x)")  
  for i=1:Niter
    oldy=y;
    y=y-f(y)*(y-x)/(f(y)-f(x));
    if (f(y)==0 |abs(y-x)<tol)
      disp("")
      disp ("The method completed successfully!")
      disp("")
      return;
    else
      epsilon=abs(oldy-x);
      disp ([i,x, oldy, y, f(y)]);
      if (f(x)*f(y)<0)
      else
	x=y;
	y=oldy;
      endif
    endif 
  endfor
  disp("")
  disp ("The method failed after (Niter)")
  disp (Niter)
  disp ("iterations")
  disp("")
endfunction