\chapter{Stirling Asymptotics}

\section{Factorial and Gamma Function}

The factorial function and the Gamma function
are related by the identity
\[
\Gamma(z+1) = z!.
\]

This relation is understood as a definition
of the factorial for non-integer values
via the Gamma function.

\section{Logarithmic Gamma Function}

For complex \(z\),
\(\mathrm{LoGamma}(z)\) denotes
the principal branch of \(\log \Gamma(z)\).

The branch cut is taken along the negative real axis.
The choice of branch affects asymptotic representations
near this axis.

\section{Stirling Expansion}

For large \(|z|\),
the Gamma function admits an asymptotic expansion
of the form
\[
\Gamma(z) \sim
\sqrt{2\pi}\, z^{z-\frac12} e^{-z}
\sum_{k=0}^{\infty} \frac{g_k}{z^k},
\]
as \(z \to \infty\)
within a sector that excludes the negative real axis.

This expansion is an asymptotic approximation
in the sense defined in Chapter~2.

\section{Domain of Validity}

The Stirling expansion is not uniform
with respect to the direction of approach
to infinity.

In particular, the approximation deteriorates
near the negative real axis,
where different asymptotic representations
are required.

Therefore, the specification of the domain
is an essential part of the asymptotic statement.

\section{Agreement Function}

To quantify the quality of an approximation,
the agreement function
\[
a(z) =
-\log_{10}
\left(
\frac{|F(z) - A(z)|}
     {|F(z)| + |A(z)|}
\right)
\]
is used.

The value of \(a(z)\)
provides an estimate
of the number of correct decimal digits
in the approximation \(A(z)\)
to the function \(F(z)\).
