function xNew = FalsePosE(f, a, b, tol, exact)

fprintf('\n False position method solver \n\n');
horzLine = '______________________________________________________';
fprintf(' n |        x(n)        |   error   | log(error)|  f(x(n)) \n%s\n', horzLine);

if (f(a)*f(b) > 0)
   fprintf('Interval [%g,%g] does not bracket the equation root \n', a, b);
end
xOld = a;

for n = 1:100
    xNew = a - f(a) * (b - a) / (f(b) - f(a));
    if ( f(xNew)*f(a) > 0 ) a = xNew;
    else b = xNew;
    end;
 
    error(n) = abs(xNew-exact);
     
    fprintf('%2d | %18.12g | %9.2e | %9.2e | %9.2e \n', n, xNew, error(n), log(error(n)), f(xNew));  
    if  abs(xNew - xOld) < tol
        ConvOrder(error);
        return
    end

    xOld = xNew;
end
fprintf('*** False position method failed to converge after 100 iterations');