format long

Left = input('Left Bound? ');
Right = input('Right Bound? ');
Guess = input('Guess? ');
Error = input('Degree of Error? ');

while (Right - Left >= Error)
%for i = 1 :Error:(Right - Left)
    
    %disp(midp);
    
    midp = (Left + Right)/2;
    
    if ( findroot(midp) == 0 )
       break;
    elseif ( findroot(Left)*findroot(midp) < 0 )
       Right = midp;
    else
       Left = midp;
    end
    
    disp('The relative approximate error in this iteration is: ');
    disp((midp - i)/midp);
    
       
end

baller = findroot(x);
plot(x, baller,'b');
hold on

plot(midp, findroot(midp),'*r');
set(gca,'XTick',-Left:(Left+Right)/2:Right)

hold on

%size(shawnkemp)
%size(baller)

disp('Your Guess is: ');
disp(Guess);
disp('The Actual Root Is:');
disp(midp);