Skip to content

BarnesG ​

The Barnes G-function G(z)G(z), the double-gamma function satisfying G(z+1)=Γ(z) G(z)G(z+1) = \Gamma(z)\,G(z) with G(1)=1G(1) = 1 — so G(n)=∏k=0n−2k!G(n) = \prod_{k=0}^{n-2} k!, the superfactorial, at positive integers.

✓ checked against that system · ! checked, with disagreements (hover a chip)WikipediaBarnes G-functionMathWorldBarnesG-FunctionWikidataQ808463DLMF5.17.E1FungrimBarnesG✓Fungrim entryWolfram LanguageBarnesG!
BarnesG(z)the Barnes G-function G(z)G(z).
mpmathbarnesg(z)Juliaenumeratio_ball(barnes_g, z)
Typed signatures
TypePackageApplies
(complex | infinity) -> numberanalyticreplaces compute-enginealways
(complex | infinity) -> numbercompute-enginealways

Domain: Special functions

Details

The Barnes G-function is the double gamma function: it satisfies G(z+1)=Γ(z) G(z)G(z+1) = \Gamma(z)\,G(z) with G(1)=1G(1) = 1 (DLMF 5.17.1), one level up from Γ(z+1)=z Γ(z)\Gamma(z+1) = z\,\Gamma(z), and carries the Weierstrass-type product G(z+1)=(2π)z/2exp⁡ ⁣(−12z(z+1)−12γz2)∏k=1∞(1+zk)kexp⁡ ⁣(−z+z22k)G(z+1) = (2\pi)^{z/2} \exp\!\left(-\tfrac12 z(z+1) - \tfrac12\gamma z^2\right) \prod_{k=1}^\infty \left(1+\tfrac{z}{k}\right)^k \exp\!\left(-z+\tfrac{z^2}{2k}\right) (DLMF 5.17.3) that entire functions are built from.

  • Functional equation G(z+1)=Γ(z) G(z)G(z+1) = \Gamma(z)\,G(z), the analogue of Γ(z+1)=z Γ(z)\Gamma(z+1) = z\,\Gamma(z) one level up; see Gamma.
  • At positive integers G(n)=0! 1! 2!⋯(n−2)!G(n) = 0!\,1!\,2!\cdots(n-2)! — the superfactorial: G(1)=G(2)=G(3)=1G(1) = G(2) = G(3) = 1, G(4)=2G(4) = 2, G(5)=12G(5) = 12, G(6)=288G(6) = 288, G(7)=34560G(7) = 34560. Exact and arbitrarily large.
  • Zeros at the nonpositive integers 0,−1,−2,…0, -1, -2, \dots (where Γ\Gamma has poles); entire, with no poles of its own.
  • Numeric evaluation exponentiates LogBarnesG: the asymptotic series for ln⁡G(z+1)\ln G(z+1) for large Re⁡(z)\operatorname{Re}(z), reached through the functional equation in logarithms. Complex zz supported; aligned with Wolfram's BarnesG[z]\mathrm{BarnesG}[z].
  • The value itself overflows a double past ∣z∣≈60|z| \approx 60 (G(60) ≈4.6×101971\approx 4.6\times10^{1971}); use LogBarnesG there, or stay exact at integers.

Plot

ComplexPlot
real slice

Examples

11 more kept as data, checked against the oracles
Basic #

G(5)=0! 1! 2! 3!=12G(5) = 0!\,1!\,2!\,3! = 12

live ↗
InBarnesG(5)\mathrm{BarnesG}(5)Out1212

G(7)=34560G(7) = 34560

live ↗
InBarnesG(7)\mathrm{BarnesG}(7)Out34 56034\,560

The superfactorials, threaded over a list

live ↗
InBarnesG([1,2,3,4,5,6])\mathrm{BarnesG}(\bigl\lbrack1, 2, 3, 4, 5, 6\bigr\rbrack)Out[1,1,1,2,12,288]\bigl\lbrack1, 1, 1, 2, 12, 288\bigr\rbrack

A floating-point argument evaluates numerically

live ↗
InBarnesG(2.5)\mathrm{BarnesG}(2.5)Out0.947 573 901 084 062 70.947\,573\,901\,084\,062\,7

G(10)=∏k=08k!G(10) = \prod_{k=0}^{8} k!, exact

live ↗
InBarnesG(10)\mathrm{BarnesG}(10)Out5 056 584 744 960 0005\,056\,584\,744\,960\,000

G(3)=0! 1!=1G(3) = 0!\,1! = 1

live ↗
InBarnesG(3)\mathrm{BarnesG}(3)Out11

G(12)G(\tfrac12) to machine precision

live ↗
InBarnesG(0.5)\mathrm{BarnesG}(0.5)Out0.603 244 281 209 589 30.603\,244\,281\,209\,589\,3
Scope #

Complex arguments

live ↗
InBarnesG(1.3+i)\mathrm{BarnesG}(1.3+i)Out1.444 613 935 050 315 3−0.298 548 825 211 568 7i1.444\,613\,935\,050\,315\,3-0.298\,548\,825\,211\,568\,7i

Negative non-integer arguments, between the zeros

live ↗
InBarnesG(−2.5)\mathrm{BarnesG}(-2.5)Out0.076 172 979 656 884 050.076\,172\,979\,656\,884\,05

Threads elementwise over an array

live ↗
InBarnesG([[12,1],[1,12]])\mathrm{BarnesG}(\bigl\lbrack\bigl\lbrack\frac{1}{2}, 1\bigr\rbrack, \bigl\lbrack1, \frac{1}{2}\bigr\rbrack\bigr\rbrack)Out[[BarnesG(12),1],[1,BarnesG(12)]]\bigl\lbrack\bigl\lbrack\mathrm{BarnesG}(\frac{1}{2}), 1\bigr\rbrack, \bigl\lbrack1, \mathrm{BarnesG}(\frac{1}{2})\bigr\rbrack\bigr\rbrack

G(∞)=∞G(\infty) = \infty

live ↗
InBarnesG(∞)\mathrm{BarnesG}(∞)Out∞∞

Interval arithmetic, proven: GG's certified derivative keeps one sign on [1.17,1.18][1.17, 1.18], so the image is its values at the ends, rounded outward

live ↗
InBarnesG(Interval(1.17,1.18))\mathrm{BarnesG}(\mathrm{Interval}(1.17, 1.18))OutInterval(1.052 216 328 686 19,1.054 193 606 435 7)\mathrm{Interval}(1.052\,216\,328\,686\,19, 1.054\,193\,606\,435\,7)

Uncertainty propagation: G(2.1±0.01)=0.98477±0.00145G(2.1 \pm 0.01) = 0.98477 \pm 0.00145, to first order in G′G'

live ↗
InBarnesG(Around(2.1,0.01))\mathrm{BarnesG}(\mathrm{Around}(2.1, 0.01))OutAround(0.984 772 724 354 046 5,0.001 449 505 695 943 639)\mathrm{Around}(0.984\,772\,724\,354\,046\,5, 0.001\,449\,505\,695\,943\,639)

To 30 significant digits, past a double's reach

live ↗
InN(BarnesG(12),30)N(\mathrm{BarnesG}(\frac{1}{2}), 30)Out0.603 244 281 209 446 206 191 429 224 5350.603\,244\,281\,209\,446\,206\,191\,429\,224\,535
Properties #

GG vanishes at the nonpositive integers

live ↗
InBarnesG(0)\mathrm{BarnesG}(0)Out00

…all of them

live ↗
InBarnesG(−3)\mathrm{BarnesG}(-3)Out00

The hyperfactorial H(n)=Γ(n+1)n/G(n+1)H(n) = \Gamma(n+1)^n / G(n+1): here 1205/288=H(5)120^5/288 = H(5)

live ↗
InΓ(6)5BarnesG(6)\frac{Γ(6)^5}{\mathrm{BarnesG}(6)}Out86 400 00086\,400\,000
Possible issues #

An exact non-integer argument stays symbolic under plain evaluation (use N(); Wolfram's closed form in Glaisher's constant is not reproduced)

live ↗
InBarnesG(52)\mathrm{BarnesG}(\frac{5}{2})OutBarnesG(52)\mathrm{BarnesG}(\frac{5}{2})
About
Examples29
Checked againstWolfram Language 20 agree9 differmpmath 21 agreeJulia 20 agree1 error
CrosswalkWikipediaMathWorldWikidataDLMFFungrimFungrim entry ×12Wolfram LanguagempmathJulia

Implementation

referenceenginenotatio

G = exp(ln G) over the Weierstrass series of LogBarnesG; see there for what it costs to evaluate.

nativeenginetypescriptpackages/ce-patches/src/compute-engine/numerics/barnes-g.ts

exp of the LogBarnesG kernel; exact superfactorials at the integers come from the head.

mappedexternalwolfram / mpmathpackages/oracle/src/mappings.ts

BarnesG[z] and mpmath.barnesg(z), same normalisation.

mappedmpmathpackages/oracle/src/mappings.ts
mappedjuliapackages/oracle/src/mappings.ts

See also: LogBarnesG, Gamma, LogGamma, Factorial