3

The equation for Stirling's Approximation is the following:

$$x! = \sqrt{2\pi x} * (\frac{x}{e})^x$$

Writing as a function for y gives us the following:

$$y = \sqrt{2\pi x} * (\frac{x}{e})^x$$

Is there a way to solve this equation for x, effectively finding an inverse to this function?

2 Answers2

1

Instead of the inverse to Stirling's approximation, you can (and should) consicder the inverse to the Gamma function itself. See this MathOverflow discussion.

Igor Rivin
  • 26,372
1

For the inverse of the factorial function, @Gary proposed in year $2013$ a superb approximation (have a look here)

$$x!= y \quad \implies \quad x \sim \frac{{\log \left( {\frac{y}{{\sqrt {2\pi } }}} \right)}}{{W\left( {\frac{1}{e}\log \left( {\frac{y}{{\sqrt {2\pi } }}} \right)} \right)}} - \frac{1}{2}\tag 1$$ where $W(.)$ is Lambert function.

If you want to make a less good approximation by yourself, start taking the logarithms of both sides and use Stirling approximation. This gives $$\log(y)=x (\log (x)-1)+\frac{1}{2} \log (2 \pi )+\frac{1}{2} \log ( x)+O\left(\frac{1}{x}\right)$$ Ignoring the last term $$\log(y)=x (\log (x)-1)+\frac{1}{2} \log (2 \pi )\implies x= \frac{{\log \left( {\frac{y}{{\sqrt {2\pi } }}} \right)}}{{W\left( {\frac{1}{e}\log \left( {\frac{y}{{\sqrt {2\pi } }}} \right)} \right)}}\tag 2$$

Using for example $y=120$, $(1)$ would give $x=4.99556$ while $(2)$ would give $x=5.49556$, while, as you know, the exact solution is $5$.