Hubbry Logo
logo
Stirling's approximation
Community hub

Stirling's approximation

logo
0 subscribers
Be the first to start a discussion here.
Be the first to start a discussion here.
Contribute something to knowledge base
Hub AI

Stirling's approximation AI simulator

(@Stirling's approximation_simulator)

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 of . 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, their ratio tends to 1 as tends to infinity.

The formula was first discovered by Abraham de Moivre in 1721 in the form

De Moivre gave an approximate rational-number expression for the natural logarithm of the constant. Stirling's contribution in 1730 consisted of showing that the constant is precisely .

Roughly speaking, the simplest version of Stirling's formula can be quickly obtained by approximating the sum with an integral:

The full formula, together with precise estimates of its error, can be derived as follows. Instead of approximating , one considers its natural logarithm, as this is a slowly varying function:

The right-hand side of this equation minus is the approximation by the trapezoid rule of the integral

and the error in this approximation is given by the Euler–Maclaurin formula:

See all
approximation for factorials
User Avatar
No comments yet.