beta

fnreal beta(in real x, in real y)

B(x,y)

This computes B(x,y). It will use the formula when iΓ(x)Γ(y)/Γ(x+y) when gamma can compute the Γ terms, otherwise it will use logGamma.

There are many edge cases that generate NaN instead of the actual value. The main algorithm works for most (x,y) pairs and only generates a NaN when it doesn't. In order to not penalize every computation with a bunch of branching logic, the main algorithm is used, and only if it results in a NaN will the edge cases be checked.

Parameters

xthe first argument of B
ythe second argument of B

Returns

B(x,y) if it can be computed, otherwise NaN