BETALN

The log-beta function returns the natural logarithm of the absolute beta function value, which is useful for stable numerical work when direct beta values are too small or too large for floating-point representation.

It computes:

\ln\left|B(a,b)\right|

where B(a,b) is the Euler beta function. This wrapper uses SciPy’s implementation for real-valued parameters.

Excel Usage

=BETALN(a, b)
  • a (float, required): First positive shape parameter.
  • b (float, required): Second positive shape parameter.

Returns (float): Natural log of the absolute beta function value.

Example 1: Log-beta with moderate parameters

Inputs:

a b
3 4

Excel formula:

=BETALN(3, 4)

Expected output:

-4.09434

Example 2: Log-beta with equal parameters

Inputs:

a b
2.5 2.5

Excel formula:

=BETALN(2.5, 2.5)

Expected output:

-2.60869

Example 3: Log-beta with large parameters

Inputs:

a b
400 900

Excel formula:

=BETALN(400, 900)

Expected output:

-804.307

Example 4: Log-beta with fractional parameters

Inputs:

a b
0.7 1.3

Excel formula:

=BETALN(0.7, 1.3)

Expected output:

0.152692

Python Code

from scipy.special import betaln as scipy_betaln

def betaln(a, b):
    """
    Compute the natural logarithm of the absolute beta function.

    See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.betaln.html

    This example function is provided as-is without any representation of accuracy.

    Args:
        a (float): First positive shape parameter.
        b (float): Second positive shape parameter.

    Returns:
        float: Natural log of the absolute beta function value.
    """
    try:
        return float(scipy_betaln(a, b))
    except Exception as e:
        return f"Error: {str(e)}"

Online Calculator

First positive shape parameter.
Second positive shape parameter.