# Relative error plot [duplicate]

I was plotting the relative error of the $e^{11/12 -n}n^{n+1/2}$ approximation to $n!$ as $n$ gets larger and larger, and at some very large value of $n$ Mathematica gives this plot:

Can somebody explain what exactly the plot means? Of course, I understand that, for larger and larger $n$, the relative error tends to a limit, but I am not sure how to interpret this plot. In particular, I don't understand how the error can show greater variation as $n$ grows large.

Thanks.

Edit: I want to add that when $n$ is an order of magnitude less what I get is something like this:

-

## marked as duplicate by Mr.Wizard♦Jul 19 '13 at 0:32

This sounds more like a math question to me. Are you asking why it levels off as n grows larger? –  cartonn Dec 10 '12 at 0:37
Similar questions: mathematica.stackexchange.com/questions/10820/… –  xzczd Dec 10 '12 at 3:17

Looks like numerical error, try increasing the WorkingPrecision

Plot[Abs[(Exp[11/12 - n] n^(n + 1/2) - n!)/n!]
,{n, 10, 10^7}
,WorkingPrecision -> 100]


WorkingPrecision is an option for various numerical operations that specifies how many digits of precision should be maintained in internal computations.

Edit You might also find Limit interesting

Limit[(Exp[11/12 - n] n^(n + 1/2) - n!)/n!, n -> Infinity]
N[%,50]
(* -1 + E^(11/12)/Sqrt[2 \[Pi]] *)
(* -0.0022692878024401615486447545367879811325821284314703  *)

-