beta

Beta function, B(x,y)

Mathematically, if x > 0 and y > 0 then B(x,y) = $(INTEGRATE 0, 1)tx-1(l-t)y-1dt. Through analytic continuation, it is extended to $(COMPLEX)$(SUP 2) where it can be expressed in terms of $(GAMMA)(z).

B(x,y) = $(GAMMA)(x)$(GAMMA)(y) / $(GAMMA)(x+y).

This implementation restricts x and y to the set of real numbers.

pure nothrow @safe @nogc pragma(inline, true)
real
beta
(
real x
,
real y
)

Parameters

x real

the first argument of B

y real

the second argument of B

Return Value

Type: real

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

Special Values
xybeta(x, y)
NaNyNaN
-∞yNaN
integer < 0yNaN
noninteger and x+y even $(LE) 0noninteger-0
noninteger and x+y odd $(LE) 0noninteger+0
+0positive finite+∞
+0+∞NaN
> 0+∞+0
-0+0NaN
-0> 0-∞
noninteger < 0, $(CEIL x) odd+∞-∞
noninteger < 0, $(CEIL x) even+∞+∞
noninteger < 0±0$(PLUSMNINF)

Since B(x,y) = B(y,x), if the table states that beta(x, y) is a special value, then beta(y, x) is one as well.

Examples

assert(beta(1, 2) == 0.5);
assert(isIdentical(beta(NaN(0xABC), 4), NaN(0xABC)));
assert(beta(3, 4) == beta(4, 3));
assert(isNaN(beta(-real.infinity, +0.)));
assert(isNaN(beta(-1, 2)));
assert(beta(-0.5, 0.5) is -0.0L);
assert(beta(-1.5, 0.5) is +0.0L);
assert(beta(+0., +0.) == +real.infinity);
assert(isNaN(beta(+0., +real.infinity)));
assert(beta(1, +real.infinity) is +0.0L);
assert(isNaN(beta(-0., +0.)));
assert(beta(-0., nextUp(+0.0L)) == -real.infinity);
assert(beta(-0.5, +real.infinity) == -real.infinity);
assert(beta(nextDown(-1.0L), real.infinity) == real.infinity);
assert(beta(nextDown(-0.0L), +0.) == +real.infinity);
assert(beta(-0.5, -0.) == -real.infinity);

Meta