Lambert- W -Function calculation? I have  an equation of the form:
$$  n \log n = x $$
Upon searching I came across the term  "Lambert- W -Function" but couldn't find a proper method for evaluation, and neither any computer code for it's evaluation. 
Any ideas as to how I can evaluate?
 A: Let us consider the function $$f(x)=x \log(x)-a$$ Effcetively, the solution of $f(x)=0$ is given by $$x=\frac{a}{W(a)}$$ and, if I properly understood, you look for a computation method for getting $W(a)$.
From definition $W(a)$ is defined such that $a=W(a)e^{W(a)}$ so Newton method seems to be (and is) very good.
I strongly suggest you have a look at http://en.wikipedia.org/wiki/Lambert_W_function. In the paragraph entitled "Numerical evaluation", they give Newton and Halley formulae (the latest one has been massively used by Corless et al. to compute $W(a)$.
In the same Wikipedia page, you will find very nice and efficient approximations of $W(a)$ for small and large values. These estimates will allow you to start really close to the solution.
If I may underline one thing which is really nice : all derivatives od $W(a)$ express as functions of $a$ and $W(a)$ itself and this is extremely convenient.
You could be interested by
 http://people.sc.fsu.edu/~jburkardt/cpp_src/toms443/toms443.html
where the source code is available.
A: Although an old post, I'm surprised nobody mentioned this:
$$n\log n=(e^{\log n})\log n=x$$
Now it should be obvious on how to proceed.
$$W(x)=\log n$$
$$e^{W(x)}=n$$
And because $W(x)e^{W(x)}=x$, $e^W(x)=\frac{x}{W(x)}$ so,
$$\frac{x}{W(x)}=n$$
A: Although this has already been answered, I think a step by step explanation is more informative than a general one. 
The following is my attempt:
\begin{align*}
n \ln (n) =x \quad & \Rightarrow \quad \ln n^n=x \\
 & \Rightarrow \quad n^n=e^x \\
 & \Rightarrow \quad n=e^{x/n} \\
 & \Rightarrow \quad n \times \frac{x}{n}=\frac{x}{n}e^{x/n} \\
 & \Rightarrow \quad x=\frac{x}{n}e^{x/n} \\
 & \Rightarrow \quad W(x)=W \left(\frac{x}{n}e^{x/n} \right) \\
 & \Rightarrow \quad W(x)=\frac{x}{n} \\
 & \Rightarrow \quad \boxed{n=\frac{x}{W(x)}} \\
& \Rightarrow \quad n=\frac{x}{x/e^{W(x)}}  \quad \text{(since 
 $W(x)e^{W(x)}=x$)}\\
& \Rightarrow \quad \boxed{n=e^{W(x)}} \\
\end{align*}
A: If you're using Matlab or want to look at a robust (but simple) implementation of the Lambert $W$ function ($W_0$ branch only) using Halley's method, see my answer here.
As an alternative to @ClaudeLeibovici's more general answer, an equation specifically of the form $n \text{ln}(n) = x$ might best be solved and analyzed using the simpler Wright $\omega$ function:
$$n = \frac{x}{\omega(-ln(1/x))}$$
Matlab has wrightOmega and Maple has Wrightomega to evaluate this function symbolically. See Corless and Jeffrey, 2002, The Wright omega Function (PDF) for further details. Unfortunately, there does not seem to be support for this function in SciPy or SymPy.
The Wright $\omega$ function can also be evaluated numerically. See Lawrence, et al., 2012, Algorithm 917: Complex Double-Precision Evaluation of the Wright ω Function. I've implemented this algorithm in Matlab – you can find it on GitHub here. Evaluating this numerically is 3+ orders of magnitude faster than evaluating it symbolically. If your $x$ parameter is constrained in particular ways (e.g., real-valued), you may be able to simplify your algorithm – see the Lawrence, et al. paper and the comments in my wrightOmega code.
