a = pi/2; b= pi; dig=35;
fprintf('\n\t\t\tMethod of Bisection     \n')
fprintf('\t\t\tf(x) = 0.5x - sin(x)    \n\n')
fprintf('Iterations      Root\n')

tol = [.5e-7 .5e-15 .5e-33];
    [n,x] = sbisec(dig,a,b,tol(1));
    fprintf('%3.0d             %1.7f\n',n,double(x))     
    [n,x] = sbisec(dig,a,b,tol(2));
    fprintf('%3.0d             %1.15f\n',n,double(x))     
    [n,x] = sbisec(dig,a,b,tol(3));
    x = char(x);
    fprintf('%3.0d             %s\n',n,x(1:33))     
fprintf('\n\t\t\tMethod of False Position     \n')
fprintf('\t\t\tf(x) = 0.5x - sin(x)    \n\n')
fprintf('Iterations      Root\n')

tol = [.5e-7 .5e-15 .5e-33];
    [n,x] = sfalsepos(dig,a,b,tol(1),1000);
    fprintf('%3.0d             %1.7f\n',n,double(x))     
    [n,x] = sfalsepos(dig,a,b,tol(2),1000);
    fprintf('%3.0d             %1.15f\n',n,double(x))     
    [n,x] = sfalsepos(dig,a,b,tol(3),1000);
    x = char(x);
    fprintf('%3.0d             %s\n',n,x(1:33))     
fprintf('\n\t\t\t\tSecant Method     \n')
fprintf('\t\t\tf(x) = 0.5x - sin(x)    \n\n')
fprintf('Iterations      Root\n')

tol = [.5e-7 .5e-15 .5e-33];
    [n,x] = ssecant(dig,a,b,tol(1),1000);
    fprintf('%3.0d             %1.7f\n',n,double(x))     
    [n,x] = ssecant(dig,a,b,tol(2),1000);
    fprintf('%3.0d             %1.15f\n',n,double(x))     
    [n,x] = ssecant(dig,a,b,tol(3),1000);
    x = char(x);
    fprintf('%3.0d             %s\n',n,x(1:33))     
fprintf('\n\t\t\t\tNewton''s Method     \n')
a=1.5;
fprintf('\t\t\tf(x) = 0.5x - sin(x)    \n')
fprintf('\t\t\t Initial guess = %1.3f\n',a)
fprintf('Iterations      Root\n')

tol = [.5e-7 .5e-15 .5e-33];

    [n,x] = snewton(dig,a,tol(1),1000);
    fprintf('%3.0d             %1.7f\n',n,double(x))     
    [n,x] = snewton(dig,a,tol(2),1000);
    fprintf('%3.0d             %1.15f\n',n,double(x))     
    [n,x] = snewton(dig,a,tol(3),1000);
    x = char(x);
    fprintf('%3.0d             %s\n',n,x(1:33)) 