# Simulating the Lambert W Distribution…

I am trying to simulate the following distribution, with pdf given by:

$$f(t) = \frac{2 \mu (1-\rho) e^{-2 \mu t} (1+\mu \rho t) \left(\rho ^{K+1} e^{\mu t}-\rho ^2 \left(e^{\mu t}-1\right)+\mu (1-\rho) \rho t-1\right)}{\left(1-\rho ^{K+1}\right)^2}$$

and cdf

$$F(t)= \frac{(1-\rho) \left(\rho -e^{-\mu t} (\rho +\mu \rho t+1)+1\right)}{1-\rho ^{K+1}},\ \ t >0,\ \rho < 1,\ \ K \gt 0$$.

I am aware that to simulate this, I need to find $$F^{-1}(u)$$, which is

$$F^{-1}(u) = \frac{\rho W\left(\frac{e^{-(1+\frac{1}{\rho })} \left(-u \rho ^{K+1}+\rho ^2+u-1\right)}{(1-\rho) \rho }\right)+\rho +1}{\mu \rho }$$,

which is (I believe) the Lambert-$$W$$ function.

The question is that I am unclear how to proceed next. Any help would be appreciated.

• I mean't to put $u$ instead of $t$ - I updated the post... – PiE Apr 2 at 19:37
• If you need the real solution, check the argument $x$ of $\operatorname{W}(x)$: $x\ge0$-one real solution, $\operatorname{W_0}(x)$; $-1/e<x<0$-two real solutions, $\operatorname{W_0}(x)$ and $\operatorname{W_{-1}}(x)$; $x=-1/e$-one real solution, $\operatorname{W_0}(-1/e)=\operatorname{W_{-1}}(-1/e)=-1$; $x<-1/e$-no real solutions. – g.kov Apr 2 at 19:43