Inverse of a log function. I need to find the inverse of: 
$$f(x) = -x-\ln(1-x),\quad x\in[0,1). $$ 
I can find it using matlab but I need to find it also for $x\in(-5,0)$ but I could not do by matlab! 
 A: You can have a solution in terms of Lambert W function 

$$ x = W(-e^{-y-1})+ 1. $$

A: As @science has stated, you can use the Lambert $W$ function to find the inverse of your equation. However, for your range of $x$, the inverse will be defined in terms of two branches of this multi-valued function. For $x \in [0,\infty)$, the solution is in terms of the upper branch, denoted $W_0(x)$, and for $x \in (-\infty,0]$, it is in terms of the lower branch, denoted $W_{-1}(x)$. In Matlab, you can use the lambertw function (documentation) to evaluate this, making sure that you call the two-argumnent form to specify the branch. So, for your $x \in (-5,0)$, you can use
x = lambertw(-1,-exp(-y-1))+1

while for $x \in [0,1)$, you can use
x = lambertw(0,-exp(-y-1))+1

Yes, you need to have an idea of the output, $x$, in order to decide which solution to choose.

For $x$ outside of the $(0, 1]$ part of your domain, the inverse of your function can also be written in terms of the Wright $\omega$ function with complex arguments, which is related to the Lambert $W$ function:
$$x = \omega(- y - 1 -\pi \mathbb{i}) + 1$$
In Matlab you can solve for the inverse of your function using the Symbolic Math toolbox:
syms x y
x = solve(y == -x-log(1-x),x)

which, in R2014b, returns:
x =

wrightOmega(- pi*1i - y - 1) + 1

This uses the Matlab's symbolic wrightOmega function (documentation). This function works with double precision inputs, but it can be slow and had numerical bugs, specifically for the situation where the imaginary part of the input is exactly $\pm \pi \text{i}$, as in your case (perhaps this is the source of your problem?). So care must be taken to ensure wrightOmega evaluates symbolically:
x = double(wrightOmega(sym(-y-1)-sym('pi')*1i))+1

This converts your input $y$ to a symbolic value and also ensures that $\pi$ is represented exactly before passing everything into wrightOmega. The output is converted back to a double-precison floating-point value. 
A much faster option that avoids symbolic math, is to use wrightOmegaq (Matlab code), my fully-vectorized and documented implementation of the algorithm in the paper: Complex Double-Precision Evaluation of the Wright omega Function by Lawrence, et al.
