Our Information Theory/Chaos professor gave us as an assignment the problem of finding the relative error of Stirling's formula of $\ln(x!)\cong x \ln(x)-x$.
I understand that the original formula is $\ln(x!)\cong (x+\dfrac{1}{2})\ln(x)-x$ but $\dfrac{1}{2}$ is small compared to large values of $x$, therefore the fist formula is still good enough and more useful.
My problem is that I can't simplify much the relative error and I end up with: \begin{equation*} \begin{split} RelError(x)&=\dfrac{f(x)-f_1(x)}{f(x)} \\ &=\dfrac{\ln(x!)-x\ln x+x}{\ln(x!)} \\ &=1-x\dfrac{\ln x-1}{\ln(x!)} \\ \end{split} \end{equation*}
I can't find a way to simplify this more. I've tried using the properties of $\ln$ and it's Taylor series but I couldn't get anything better than this.
I went ahead and plotted this function in Matlab
So I know it´s properties, but I can´t really do anything with it due to the $\ln(x!)$ part. I would like to add if possible a few examples of x for which the relative error is less than some values (for example $0.05, 0.005$ etc), but to do that I need a way to reduce the inequality and not even Matlab's Reduce command gave me an answer.
So if it isn't possible to simplify the formula I would like to ask for your opinion on how to reduce the inequality with possibly a different command.
I am not asking for a direct solution to the problem, obviously I don't want an easy way out of this assignment, I just need a little help to understand what I must do to solve my problem.