Shapes & spaces

Barnes G function calculator with recurrence and log value

Calculate positive-real Barnes G and log G using recurrence and asymptotic refinement diagnostics.

Your numbers

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

The Barnes G function satisfies a recurrence that multiplies by gamma whenever its argument increases by one. Starting from G of one equal to one, integer arguments therefore generate products of factorials rather than a single factorial.

THE FORMULAForx>0, shiftX=x+m>=12(or20), evaluatez=X-1 with logG(z+1)=(z²/2-1/12)logz-3z²/4+zlog(2π)/2+ζ'(-1)+sum_{k>=1}B_{2k+2}/[2k(2k+2)z^(2k)]. ζ'(-1)=-.1654211437004509292. Subtractsum_{j=0}^{m-1}logGamma(x+j) toshiftback. Asymptotictruncateatleastterm, don'tsumindefinitely; independenterroranalysis needed forclaimedprecision. ReturnlogG always andexpifrepresentable. G(n)=product_{j=1}^{n-2}j! checksG1=G2=G3=1,G4=2,G5=12.

A worked example

With the prefilled inputs, logG = 2.484906649787888.

Good to know

Positive-real Barnes G, normalized G(1)=1. Bernoulli asymptotic plus log-gamma recurrence; refinement is not a rigorous error enclosure.

A product one level above gamma

The Barnes G function satisfies a recurrence that multiplies by gamma whenever its argument increases by one. Starting from G of one equal to one, integer arguments therefore generate products of factorials rather than a single factorial.

The calculator returns both G and its logarithm for a positive real argument. The logarithmic value remains useful when the ordinary value is too large or too small for a floating-point display. It should not be treated as an unrelated approximation.

Barnes G function calculator with recurrence and log valueBarnes G at integers: products of factorials12345678log G(n)G(4) = 2; G(5) = 12; G(6) = 288
Scroll across to see the full diagram.
Bar heights use independently summed logarithms of factorials, logG(n)=Σlog(k!). They illustrate the integer recurrence and avoid overflow; in particularG(5)=12.

Compare with the Complex log gamma calculator with a stated principal branch. Evaluate the doublegamma-relatedG recurrence G(z+1)=Gamma(z)G(z), notGammaitselfor itslog.

Positive real inputs

Use the prefilled input structure and preserve the declared column or index order. A strictly positive argument keeps this version on a real branch without crossing negative zeros or complex branch cuts. The supported argument interval is0.1 through50, and the answer includes a comparison between evaluations shifted to two different asymptotic starting regions. Extending the range into the complex plane would require additional conventions and numerical methods.

An argument close to zero can lead to a very small G value. The logarithm handles that scale naturally, whereas directly multiplying many gamma factors can underflow. Parsing and validation should reject nonfinite values before recurrence or asymptotic evaluation begins.

Shifting to a stable evaluation region

The recurrence allows a small positive argument to be moved to a larger one where an asymptotic expansion is effective. After evaluating the larger argument, subtract the corresponding log-gamma terms to recover the desired logarithmic value.

The direction of that correction is easy to reverse accidentally. Moving from x to x plus one multiplies G by gamma of x, so returning from the shifted value requires subtraction in logarithmic coordinates. Integer fixtures expose such a sign error clearly.

Asymptotic terms and truncation

The leading logarithmic expression contains a quadratic-times-log term, a quadratic term, a linear term and a constant. Bernoulli corrections decrease initially when the shifted argument is sufficiently large. The expansion is asymptotic, so adding terms forever is not the right strategy.

The current method uses a fixed bounded Bernoulli correction sequence after shifting and compares two recurrence starting targets. That recurrence-refinement difference is a numerical diagnostic, not a rigorous remainder enclosure or an automatic least-term proof. A tiny last term alone is not automatically a rigorous error bound for every argument. Independent recurrence and high-precision comparisons help assess the claimed decimal accuracy.

A factorial-product worked example

For argument five, recurrence gives gamma of four times gamma of three times gamma of two times gamma of one, starting from G of one. Those factors are six, two, one and one, so G of five is twelve.

Its natural logarithm is approximately 2.484906650. At argument four the value is two, while the first three positive integer arguments all have value one. These neighboring checks ensure that the recurrence is indexed correctly.

Reading values without overflow

The main answer should state whether an ordinary G value is representable. If exponentiating the logarithm overflows, retain the finite logarithmic result and explain the display limit. A numerical infinity is not a statement that the mathematical function is infinite at a positive input.

A static plot of log G across the allowed interval makes the changing scale easier to see. Recurrence checkpoints at integer arguments are useful labels. A plot of raw G alone may flatten all smaller values against the axis. Large positive arguments can give a perfectly finite logarithm even when exponentiating it exceeds floating-point range. In that situation the logarithmic output remains useful and the ordinary G value is explicitly marked outside the exponential range. Comparing recurrence evaluations at two shifted asymptotic starting points is a diagnostic for this implementation, not a proof of a globally uniform error bound.

What this page does not continue

Negative arguments involve zeros and sign or branch considerations that are excluded here. Complex Barnes functions require explicit logarithmic branches. This positive-real calculation should not quietly return an absolute value when an unsupported input would otherwise be inconvenient.

The function is mathematically distinct from gamma and double factorial, even though their products are related. Comparisons should use the stated recurrence and normalization. Matching one large rounded value is weaker evidence than matching a chain of exact integer relations. Positive-real Barnes G, normalized G(1)=1. Bernoulli asymptotic plus log-gamma recurrence; refinement is not a rigorous error enclosure.

A few questions, answered

Why return the logarithm as well?

It avoids overflow or underflow and preserves useful information when the ordinary value cannot be displayed.

Is Barnes G the same as gamma?

No; its one-step recurrence multiplies by gamma, producing factorial products at integer arguments.

Can negative arguments be entered?

Not in this positive-real version, which excludes negative zeros and branch conventions.

Should more asymptotic terms always improve accuracy?

No; an asymptotic expansion must be truncated appropriately rather than summed indefinitely.

Find your calculator

Start typing to explore the library.