function [ X, fX ] = bisection( func, a, b, eps )
%X = zeros(100,1);
%fX = zeros(100,1);
disp('===============================');
disp('     x              f(x)     i ');
disp('-------------------------------');

for k=1:100
    c = (a+b)/2;
    x=a;
    fa = eval(func);
    x=b;
    fb = eval(func);
    x=c;
    fc = eval(func);

    fprintf('%10f %15f %3d\n', c, fc, k);
    
    X(k,1) = c;
    fX(k,1) = fc;

    if (fc == 0 || abs(fc) < eps)
        disp('-------------------------------');
        disp('*** Solution Reached! ***');
        disp('===============================');
        return;
    end
end

disp('-------------------------------');
disp('!!! Method did not converge !!!');
disp('===============================');
