LogGamma
The log-gamma function as an analytic continuation (branch cut on ), which differs from by multiples of off the positive axis.
Gamma functionMathWorldLogGammaFunctionGammaFunctionWikidataQ190573Encyclopedia of MathematicsGamma-functionnLabGamma functionBritannicascience/gamma-functionDLMF5.2.E1FungrimLogGammaWolfram LanguageLogGamma✓LogGamma(z)the log-gamma function , analytically continued.log_gamma(z)SymPyloggamma(z)mpmathloggamma(z)Juliaenumeratio_ball(lgamma, z)Rustln_gamma(z)Typed signatures
| Type | Package | Applies |
|---|---|---|
(complex | infinity) -> number | analyticreplaces compute-engine | always |
(complex | infinity) -> number | compute-engine | always |
Details
- For real it is simply : , -- where it agrees with compute-engine's own GammaLn.
- Elsewhere it is the continuation across the upper and lower half-planes, continuous off — the convention Wolfram's and mpmath's
loggammashare. with a principal logarithm jumps by wherever crosses the negative axis; this does not. GammaLn is that principal version, so the two genuinely differ: at , GammaLn is while LogGamma is . - at the poles of , the nonpositive integers.
- Numerically, Stirling's series for large with the recurrence — in principal logarithms, which for is exactly the continuation. compute-engine has a complex Gamma but no LogGamma of its own.
Plot
Examples
4 more kept as data, checked against the oraclesBasic #
Scope #
Huge arguments: , from Stirling's series directly rather than through itself, which overflows a double long before its log would; the answer carries the engine's precision
live ↗Properties #
Possible issues #
Off the positive axis this is the continuation: with a principal log has imaginary part , a full away
live ↗LogGamma(NegativeInfinity) is Indeterminate: the negative axis is LogGamma's own branch cut, where Gamma oscillates in sign between poles with no single limit
live ↗Known value · DLMF 5.2, via Gamma(NegativeInfinity) = Indeterminate
About
| Examples | 25 |
|---|---|
| Checked against | Wolfram Language 24 agreeSageMath 19 agree2 differ2 errorSymPy 20 agree2 differ2 errormpmath 19 agree4 errorJulia 17 agree6 errorRust 9 agree1 differ3 unevaluated6 error |
| Crosswalk | WikipediaMathWorld ×2WikidataEncyclopedia of MathematicsnLabBritannicaDLMFFungrimWolfram LanguageSageMathSymPympmathJuliaRust |
Implementation
notatioThe continuation pinned by lnΓ(1) = 0 and (lnΓ)′ = ψ — which is what makes it the continuation and not Ln(Gamma(z)), whose branch differs off the positive axis.
typescriptpackages/ce-patches/src/compute-engine/numerics/log-gamma.tswolfram / mpmathpackages/oracle/src/mappings.tsLogGamma[z] and mpmath.loggamma(z) — both the continuation, not Log[Gamma[z]].
sympypackages/oracle/src/mappings.tsmpmathpackages/oracle/src/mappings.tsThe principal branch, cut along the negative reals, as in Wolfram.
sagepackages/oracle/src/mappings.tsjuliapackages/oracle/src/mappings.tsrustpackages/oracle/src/mappings.ts See also: Gamma, GammaLn, LogBarnesG, Digamma