function xr=bisection(f,xl,xu)
% bisection root finding method
maxit=100;
iter=0;
es=0.0000001;
ea=1.1*es;
while((ea>es)&&(iter<maxit))
    xr=(xl+xu)/2.0;
    iter=iter+1;
    if xr~=0 ea=abs((xu-xl)/(xu+xl))*100;end
    fxl= f(xl);
    fxr= f(xr);
    test= fxl*fxr;
    if test == 0.0      ea=0;
    elseif test < 0.0  xu=xr;
    else               xl=xr;
    end
end
if(iter>=maxit) fprintf('Maximum number of iteration is exceeded result might not be valid","MAKSÝMUM NUMBER OF ITERATION WARNING'); 
end
end
