# $$\text{B}$$¶

You can use the $$\text{B}$$ function to calculate the beta function of a value.

You can use the \betafn backslash command to insert this function.

The following variants of this function are available:

• $$\text{complex } \text{B} \left ( \text{<s>}, \text{<z>} \right )$$

Note that the function is only defined for $$s > 0$$ and $$z > 0$$. The $$\text{B}$$ function will return NaN for zero or negative values of $$s$$ or $$z$$.

For small positive real values of $$s$$ and $$z$$, this function calculates the beta function using the relation:

$\text{B} \left ( s, z \right ) = \frac{\Gamma \left ( s \right ) \Gamma \left ( z \right )} {\Gamma \left ( s + z \right )}$

For larger values of $$s$$ and $$z$$ or in cases where either $$s$$ or $$z$$ are complex, this function calculates values using the $$\text{lnGamma}$$ function:

$\text{B} \left ( s, z \right ) = \mathit{e} ^ { \left ( \text{ln } \Gamma \left ( s \right ) + \text{ln } \Gamma \left ( z \right ) - \text{ln } \Gamma \left ( s + z \right ) \right ) }$

For real values of $$s$$ and $$z$$, the threshold used to determine how the $$\text{B}$$ function is calculated is based on the magnitude of the expected value returned by the $$\Gamma$$ function.

Note

The function name uses Greek upper case ‘’beta’’ as the function name, not the letter ‘’B’’.

Below is a simple example using the beta function:

$a = \text{B} \left ( 2, 1 \right )$
$\text{a = 0.5}$