%SSECANT Symbolic secant method
%
function [n,x]=ssecant(dig,a,b,tol,nmax)
n=0;
digits(dig);
a=vpa(a);b=vpa(b);
fa=f(a);
x=b;
while subs(abs(x-a))>= tol
    n=n+1;
    if n>nmax
        fprintf('n exceeds nmax')
        return
    end
    b=a;
    fb=fa;
    a=x;
    fa=f(x);
    x=a-(a-b)*f(a)/(fa-fb);
end

 function y=f(x)
 y = 0.5*x-sin(x);

