function [x,k] = bisekce(f,a,b,epsil)

k = 1;
x = (a+b)/2;
fa = f(a); fb = f(b);
fx = f(x);
while abs(f(x))>epsil
    if fa*fx < 0
        b = x; fb = fx;
    else
        a = x; fa = fx;
    end
    x = (a+b)/2;
    fx = f(x);
    k = k+1;
end