Is there an inverse to Stirling's approximation? The factorial function cannot have an inverse, $0!$ and $1!$ having the same value. However, Stirling's approximation of the factorial $x! \sim x^xe^{-x}\sqrt{2\pi x}$ does not have this problem, and could provide a ballpark inverse to the factorial function. But can this actually be derived, and if so how? Here is my work:
$$
\begin{align}
y &= x^xe^{-x}\sqrt{2\pi x}\\
y^2 &= 2\pi x^{2x + 1}e^{-2x}\\
\frac{y^2}{2\pi} &= x^{2x + 1}e^{-2x}\\
\ln \frac{y^2}{2\pi} &= (2x + 1)\ln x - 2x\\
\ln \frac{y^2}{2\pi} &= 2x\ln x + \ln x - 2x\\
\ln \frac{y^2}{2\pi} &= 2x(\ln x - 1) + \ln x
\end{align}
$$
That is as far as I can go. I suspect the solution may require the Lambert W function.
Edit: I have just realized that after step 3 above, one can divide both sides by e to get
$$\left(\frac{x}{e}\right)^{2x + 1} = \frac{y^2}{2e\pi}$$
Can this be solved?

If you wish to make an inverse of the factorial for a fractional value, try starting with one of the aproximations here and solving for $x$. The two formulas are $$x!\approx\sqrt{2\pi}x^xe^{-x}\sqrt{x+\frac{1}{6}+\frac{1}{72x}-\frac{31}{6480x^2}-\frac{139}{155520x^3}+\frac{9871}{6531840x^4}}\\
x!\approx\sqrt{2\pi}x^xe^{-x}\root{\LARGE{4}}\of{x^2+\frac{x}{3}+\frac{1}{18}-\frac{2}{405x}-\frac{31}{9720x^2}}$$ They may not be as simple to solve as your Stirling approximation, but they're much more accurate for smaller values of $x$. Read the article while you're at it.
Update: apparently Ramanujan's approximation is even more accurate. $$x!\approx\sqrt{\pi}\left(\frac{x}{e}\right)^x\root{\LARGE{6}}\of{8x^3+4x^2+x+\frac{1}{30}}$$
