f = @(x) (x^3-7*x^2+15*x-19);
a0=4.6154; b0=5;
N=5; % number of iterations
e=0.0; % accuracy
d=4; % number of digits (sig fig) rounding
digits(d)

a(1)=a0; b(1)=b0;
disp("f(a0)=f("+a0+")="+f(a0));
disp("f(b0)=f("+b0+")="+f(b0));
for i=1:N
    c(i)=b(i)-( (b(i)-a(i))/(f(b(i))-f(a(i))) )*f(b(i));
    %c(i)=vpa(c(i));
    disp("f(c"+(i-1)+")=f("+c(i)+")="+f(c(i)));
    disp(" ");
    if abs(f(c(i)))<e
        break;
    end
    if f(a(i))*f(c(i))<0
        a(i+1)=a(i);
        b(i+1)=c(i);
    elseif f(c(i))*f(b(i))<0
        a(i+1)=c(i);
        b(i+1)=b(i);
    end
    if i~=N
        disp("f(a"+i+")="+"f("+a(i+1)+")="+f(a(i+1)));
        disp("f(b"+i+")="+"f("+b(i+1)+")="+f(b(i+1)));
    end
end