LogGamma[z]
gives the logarithm of the gamma function
.
LogGamma
LogGamma[z]
gives the logarithm of the gamma function
.
Details
- Mathematical function, suitable for both symbolic and numerical manipulation.
- LogGamma[z] is analytic throughout the complex z plane, except for a single branch cut discontinuity along the negative real axis. Log[Gamma[z]] has a more complex branch cut structure.
- For certain special arguments, LogGamma automatically evaluates to exact values.
- LogGamma can be evaluated to arbitrary numerical precision.
- LogGamma automatically threads over lists.
- LogGamma can be used with Interval and CenteredInterval objects. »
Examples
open all close allBasic Examples (5)
LogGamma[2.5]LogGamma[10. ^ 1000]Plot over a subset of the reals:
Plot[LogGamma[x], {x, 0, 5}]Plot over a subset of the complexes:
ComplexPlot3D[LogGamma[z], {z, -2 - 2I, 2 + 2I}, PlotLegends -> Automatic]Series expansion about the origin:
Series[LogGamma[z], {z, 0, 4}]Series expansion at Infinity:
Series[LogGamma[z], {z, ∞, 4}]Scope (36)
Numerical Evaluation (5)
Evaluate numerically to high precision:
N[LogGamma[22 / 10], 50]The precision of the output tracks the precision of the input:
LogGamma[2.20000000000000000000000]LogGamma[2.5 + 3I]Evaluate LogGamma efficiently at high precision:
LogGamma[2.2`500]//TimingLogGamma[2.2`5000];//TimingCompute worst-case guaranteed intervals using Interval and CenteredInterval objects:
LogGamma[Interval[{0.41, 0.42}]]LogGamma[CenteredInterval[0.4, 0.01]]Or compute average-case statistical intervals using Around:
LogGamma[ Around[1.2, 0.01]]Compute the elementwise values of an array:
LogGamma[{{1 / 2, -1}, {0, 1 / 2}}]Or compute the matrix LogGamma function using MatrixFunction:
MatrixFunction[LogGamma[#]&, {{1 / 2, -1}, {0, 1 / 2}}]//FullSimplifySpecific Values (4)
Give exact results for integers and half-integers:
LogGamma[5]LogGamma[-3 / 2]Some singular points of LogGamma:
{LogGamma[0], LogGamma[-1], LogGamma[-2], LogGamma[-3]}LogGamma[{Infinity, -Infinity, I Infinity}]LogGamma[ComplexInfinity]Find a zero of LogGamma:
xzero = Solve[LogGamma[x] == 0 && 0 < x < 2, x, Reals][[1, 1, 2]]//QuietPlot[LogGamma[x], {x, 0, 4}, Epilog -> Style[Point[{xzero, LogGamma[xzero]}], PointSize[Large], Red]]Visualization (2)
Plot LogGamma:
Plot[LogGamma[x], {x, 0, 5}]ComplexContourPlot[Re[LogGamma[z]], {z, -4 - 4I, 4 + 4 I}, Contours -> 20]ComplexContourPlot[Im[LogGamma[z]], {z, -4 - 4I, 4 + 4 I}, Contours -> 20]Function Properties (8)
LogGamma is defined for all positive real values:
FunctionDomain[LogGamma[x], x]FunctionDomain[LogGamma[z], z, Complexes]LogGamma is not an analytic function:
FunctionAnalytic[LogGamma[x], x]Has both singularities and discontinuities:
FunctionSingularities[LogGamma[x], x]FunctionDiscontinuities[LogGamma[x], x]LogGamma is neither nondecreasing nor nonincreasing:
FunctionMonotonicity[{LogGamma[x], x > 0}, x]LogGamma is not injective:
FunctionInjective[LogGamma[x], x]Plot[{LogGamma[x], 1}, {x, 0, 5}]LogGamma is not surjective:
FunctionSurjective[LogGamma[x], x]Plot[{LogGamma[x], -2}, {x, 0, 6}]LogGamma is neither non-negative nor non-positive:
FunctionSign[{LogGamma[x], x > 0}, x]LogGamma is convex on its real domain:
FunctionConvexity[{LogGamma[x], x > 0}, x]Differentiation (3)
First derivative of LogGamma:
D[LogGamma[x], x]Higher derivatives of LogGamma:
Table[D[LogGamma[x], {x, n}], {n, 1, 4}]Plot[Evaluate[%], {x, 0, 4}, PlotLegends -> {"First Derivative", "Second Derivative", "Third Derivative", "Fourth Derivative"}]D[LogGamma[x], {x, n}]Integration (3)
Indefinite integral of LogGamma:
Integrate[LogGamma[x], x]Compute integrals involving LogGamma:
Integrate[x LogGamma[x], {x, 0, 1}]Integrate[LogGamma[1 + x], x]Integrate[x^2LogGamma[x], x]Definite integral for complex values of LogGamma:
Integrate[LogGamma[x], {x, -2, 0}]Series Expansions (5)
Series expansion at the origin:
Series[LogGamma[z], {z, 0, 5}]Taylor expansion for LogGamma around
:
Series[LogGamma[x], {x, 1, 3}]Plot the first three approximations for LogGamma around
:
terms = Normal@Table[Series[LogGamma[x], {x, 1, m}], {m, 1, 3}];
Plot[{LogGamma[x], terms}, {x, 0, 2}]Series[LogGamma[z], {z, Infinity, 5}]Give the result for an arbitrary symbolic direction
:
Series[LogGamma[z], {z, DirectedInfinity[], 5}]Series expansion at poles of the LogGamma function:
Series[LogGamma[z], {z, -5, 3}]LogGamma can be applied to a power series:
LogGamma[1 + x + (x^2/2) + O[x]^4]Function Identities and Simplifications (3)
Use FullSimplify to simplify logarithmic gamma functions:
FullSimplify[LogGamma[z] - Log[Gamma[z]], z > 0]Use FunctionExpand to express through Gamma:
FunctionExpand[LogGamma[z], z > 0]LogGamma[z] == LogGamma[z + 1] - Log[z]//FullSimplifyFunction Representations (3)
Series representation of LogGamma:
FullSimplify[LogGamma[z] == Sum[(z/k) - Log[1 + (z/k)], {k, 1, Infinity}] - z EulerGamma - Log[z]]Integral representation of LogGamma through PolyGamma:
Integrate[PolyGamma[t], {t, 1, z}]TraditionalForm formatting:
LogGamma[z]//TraditionalFormApplications (4)
Calculate ratio of Gamma functions at very large arguments:
Exp[LogGamma[10. ^ 16] - LogGamma[10. ^ 16 + 12.]]Direct calculation fails because intermediate numbers are too large:
Gamma[10. ^ 15] / Gamma[10. ^ 15 + 12]Find the first few digits of
:
Block[{$MaxExtraPrecision = Infinity}, 10 ^ N[FractionalPart[LogGamma[10 ^ 100 + 1] / Log[10]], 10]]Plot of the imaginary part of LogGamma[z] and Log[Gamma[z]] over the complex
plane:
Table[With[{f = f}, Plot3D[Im[f[x + I y]], {x, -3, 3}, {y, -1, 1}, PlotTheme -> "Detailed", ImageSize -> Small]], {f, {LogGamma, Log @* Gamma}}]Determine the number of bins to use for bimodal data by Knuth's Bayesian method:
ExampleData[{"Statistics", "OldFaithful"}, "ColumnDescriptions"]data = ExampleData[{"Statistics", "OldFaithful"}][[All, 1]];optBins[data_, M_Integer] := Block[{nn = Length[data], n, p1, p2, min, max}, {min, max} = Through[{Min, Max}[data]];
n = N[HistogramList[data, {min, max + (max - min) / M, (max - min) / M}][[2]]];
p1 = nn Log[M] + LogGamma[M / 2] - LogGamma[nn + M / 2];
p2 = -M LogGamma[1 / 2] + Total[LogGamma[n + 1 / 2]];p1 + p2]The optimal number of bins maximizes the log of the posterior density:
oBins = Table[{nbin, optBins[data, nbin]}, {nbin, Length[data] / 6}];ListLinePlot[oBins, Filling -> Axis, AxesOrigin -> {0, -300}]Properties & Relations (6)
Use FullSimplify to simplify logarithmic gamma functions:
FullSimplify[LogGamma[z] - Log[Gamma[z]], z > 0]Use FunctionExpand to express through Gamma:
FunctionExpand[LogGamma[z], z > 0]Numerically find a root of a transcendental equation:
FindRoot[LogGamma[z] - 4 LogGamma[z + 2] ^ 2 + z == 2, {z, 1}]Reduce[Implies[x > 0, LogGamma''[x] > 0], Reals]Find minimum of
on the positive real axis:
{minval, minargRule} = NMinimize[{LogGamma[x], x > 0}, x]Plot[LogGamma[x], {x, 0, 3}, Epilog -> {Red, PointSize[Large], Point[{x /. minargRule, minval}]}]In TraditionalForm,
is automatically interpreted as the gamma function:
logΓ(z)Possible Issues (2)
Neat Examples (2)
Plot LogGamma at the Gaussian integers:
Block[{$MaxExtraPrecision = 100}, ArrayPlot[Table[Mod[Re@Round[LogGamma[x + I y]], 2], {x, 1, 50}, {y, 1, 50}]]]Riemann surface of LogGamma:
With[{ϵ = 10 ^ -6}, Show[Table[Plot3D[Im[LogGamma[x + I y] + 2 Pi I k], {x, i + ϵ, i + 1 - ϵ}, {y, j + ϵ, j + 1 - ϵ}, Mesh -> False, PlotRange -> All, BoundaryStyle -> None, PlotPoints -> 6], {k, -1, 1}, {i, -3, 2}, {j, -3, 2}], BoxRatios -> {1, 1, 1}, ViewPoint -> {-2.5, -2, 1.4}]]Tech Notes
Related Guides
Related Links
History
Introduced in 1991 (2.0) | Updated in 2021 (13.0) ▪ 2022 (13.1)
Text
Wolfram Research (1991), LogGamma, Wolfram Language function, https://reference.wolfram.com/language/ref/LogGamma.html (updated 2022).
CMS
Wolfram Language. 1991. "LogGamma." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2022. https://reference.wolfram.com/language/ref/LogGamma.html.
APA
Wolfram Language. (1991). LogGamma. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/LogGamma.html
BibTeX
@misc{reference.wolfram_2026_loggamma, author="Wolfram Research", title="{LogGamma}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/LogGamma.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_loggamma, organization={Wolfram Research}, title={LogGamma}, year={2022}, url={https://reference.wolfram.com/language/ref/LogGamma.html}, note=[Accessed: 13-June-2026]}