function [ w ] = wbisect( x )
%WBISECT wbisect(x) uses bisection to compute the Lambert W function W(x) which solves W*exp(W)=x 
    a=0;
    b=x;
    while abs(b-a) > eps(a)
        c = (a+b)/2;
        if c*exp(c) >= x
            b=c;
        else
            a=c;
        end
    end
    w=c;
end

