Stirling's approximation

In mathematics, Stirling's approximation (or Stirling's formula) is an asymptotic approximation for factorials. It is a good approximation, leading to accurate results even for small values of . It is named after James Stirling, though a related but less precise result was first stated by Abraham de Moivre.

One way of stating the approximation involves the logarithm of the factorial:

where the big O notation means that, for all sufficiently large values of , the difference between and will be at most proportional to the logarithm. In computer science applications such as the worst-case lower bound for comparison sorting, it is convenient to instead use the binary logarithm, giving the equivalent form

The error term in either base can be expressed more precisely as , corresponding to an approximate formula for the factorial itself,

Here the sign means that the two quantities are asymptotic, that is, that their ratio tends to 1 as tends to infinity. The following version of the bound holds for all , rather than only asymptotically:

This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.