function [root] = dixotomos(diastima)
%finds the root of the function f(x)=x+10*exp(-x^2)*cos(x);
a=diastima(1);
b=diastima(2);
tol=10^(-5);
    while abs(a-b)>tol;
        c=(a+b)/2;
        if f(c)*f(a)<0
            b=c;
        elseif f(c)*f(b)<0
            a=c;
        else        
            break
        end 
    end
    disp(' ')
    disp(['the root of f(x) is ', num2str((a+b)/2)])
    disp(' ')
    disp(['validation: f(x) = ', num2str(f(c))])    
    root=(a+b)/2;
end


function [result]=f(x)
    result=x+10*exp(-x^2)*cos(x);
end



