Stirling's approximation fractional error

440 Views Asked by At

Given Stirling's approximation $lnN!$ is approximated by $NlnN-N+\frac{1}{2}lnN$. I want to calculate the fractional error that comes from neglecting the third term $\frac{1}{2}lnN$ for N=10 and N=100. I thought it would be enough to consider $\frac{\frac{1}{2}lnN}{NlnN-N+\frac{1}{2}lnN}$, but for N=10 I get 0.08, while, according to my professor, the answer is 0.05. I have an identical issue with N=100, where I get 0.006 instead of 0.005. Is there a problem with the way I am calculating the fractional error? I can't really see any other reason why I keep getting the wrong results.