Skip to content

Symmetric functions

Symmetric polynomials: Schur, power-sum and monomial.

The Schur polynomial \(s_\lambda\) is evaluated by the Jacobi–Trudi determinant in the complete homogeneous symmetric polynomials; it is what the Schur–Weyl measure evaluates. The module also gives the power sums \(p_\mu\), the monomial symmetric polynomials \(m_\mu\), and the expansion of \(m_\mu\) in the Schur basis, a row of the inverse Kostka matrix.

schur_polynomial

schur_polynomial(lam: tuple[int, ...], xs: list[float]) -> float

Get the schur polynomial of a partition evaluated on input xs Not very precise above len(lam) = 7

Parameters:

Name Type Description Default
lam tuple[int, ...]

The partition

required
xs list[float]

The input variables

required

Returns:

Type Description
float

the value of the polynomial

Source code in src/schur_weyl/symmetric_functions.py
def schur_polynomial(lam: tuple[int, ...], xs: list[float]) -> float:
    """Get the schur polynomial of a partition evaluated on input xs
    Not very precise above len(lam) = 7

    Args:
        lam (tuple[int, ...]): The partition
        xs (list[float]): The input variables

    Returns:
        float: the value of the polynomial
    """
    return _jacobi_trudi(lam, xs)

h_0_to_k

h_0_to_k(k: int, xs: list[float]) -> list[float]

Completely homogenous symmetric polynomial from h_0 to h_k

Parameters:

Name Type Description Default
k int

k

required
xs list[float]

The input values

required

Returns:

Type Description
list[float]

h_0 to h_k

Source code in src/schur_weyl/symmetric_functions.py
def h_0_to_k(k: int, xs: list[float]) -> list[float]:
    """Completely homogenous symmetric polynomial from h_0 to h_k

    Args:
        k (int): k
        xs (list[float]): The input values

    Returns:
        list[float]: h_0 to h_k
    """
    h_i: list[float] = [1.0] + [0.0] * k
    for xi in xs:
        for i in range(1, k + 1):
            h_i[i] += xi * h_i[i - 1]
    return h_i

power_sum

power_sum(mu: tuple[int, ...], xs: list[float]) -> float

p_mu(x) = prod_i (sum_j x_j^{mu_i}).

Examples:

>>> power_sum((1,), [2, 3])        # p_1 = 2 + 3
5
>>> power_sum((2,), [2, 3])        # p_2 = 4 + 9
13
>>> power_sum((2, 1), [2, 3])     # p_2 * p_1 = 13 * 5
65
>>> power_sum((), [2, 3])
1
Source code in src/schur_weyl/symmetric_functions.py
def power_sum(mu: tuple[int, ...], xs: list[float]) -> float:
    """p_mu(x) = prod_i (sum_j x_j^{mu_i}).

    Examples:
        >>> power_sum((1,), [2, 3])        # p_1 = 2 + 3
        5
        >>> power_sum((2,), [2, 3])        # p_2 = 4 + 9
        13
        >>> power_sum((2, 1), [2, 3])     # p_2 * p_1 = 13 * 5
        65
        >>> power_sum((), [2, 3])
        1
    """
    result = 1
    for part in mu:
        result *= sum(xj**part for xj in xs)
    return result

monomial_symmetric

monomial_symmetric(mu: tuple[int, ...], xs: list[float]) -> float

The monomial symmetric polynomial m_mu evaluated on input xs: the sum of x^alpha over the distinct rearrangements alpha of mu (padded with zeros to len(xs)).

Computed variable by variable, keeping track of which parts of mu are still unassigned.

Parameters:

Name Type Description Default
mu tuple[int, ...]

The partition

required
xs list[float]

The input variables

required

Returns:

Type Description
float

the value of the polynomial

Examples:

>>> monomial_symmetric((1, 1), [2, 3, 5])   # 2*3 + 2*5 + 3*5
31
>>> monomial_symmetric((2, 1), [2, 3])      # 4*3 + 9*2
30
>>> monomial_symmetric((1, 1, 1), [2, 3])   # more parts than variables
0
>>> monomial_symmetric((), [2, 3])
1
Source code in src/schur_weyl/symmetric_functions.py
def monomial_symmetric(mu: tuple[int, ...], xs: list[float]) -> float:
    """The monomial symmetric polynomial m_mu evaluated on input xs:
    the sum of x^alpha over the distinct rearrangements alpha of mu (padded with zeros to len(xs)).

    Computed variable by variable, keeping track of which parts of mu are still unassigned.

    Args:
        mu (tuple[int, ...]): The partition
        xs (list[float]): The input variables

    Returns:
        float: the value of the polynomial

    Examples:
        >>> monomial_symmetric((1, 1), [2, 3, 5])   # 2*3 + 2*5 + 3*5
        31
        >>> monomial_symmetric((2, 1), [2, 3])      # 4*3 + 9*2
        30
        >>> monomial_symmetric((1, 1, 1), [2, 3])   # more parts than variables
        0
        >>> monomial_symmetric((), [2, 3])
        1
    """
    counts = Counter(mu)
    parts = list(counts)
    # remaining multiplicity of each distinct part -> accumulated value
    state: dict[tuple[int, ...], float] = {tuple(counts[p] for p in parts): 1}
    for xi in xs:
        new_state: dict[tuple[int, ...], float] = {}
        for remaining, value in state.items():
            new_state[remaining] = new_state.get(remaining, 0) + value
            for j, part in enumerate(parts):
                if remaining[j]:
                    nxt = remaining[:j] + (remaining[j] - 1,) + remaining[j + 1 :]
                    new_state[nxt] = new_state.get(nxt, 0) + value * xi**part
        state = new_state
    return state.get((0,) * len(parts), 0)

monomial_in_schur_basis

monomial_in_schur_basis(mu: tuple[int, ...]) -> list[tuple[int, tuple[int, ...]]]

Expand the monomial symmetric function m_mu in the Schur basis.

A row of inverse_kostka_matrix.

Parameters:

Name Type Description Default
mu tuple[int, ...]

The partition

required

Returns:

Type Description
list[tuple[int, tuple[int, ...]]]

pairs (coefficient, nu) with m_mu = sum coefficient * s_nu

Examples:

>>> monomial_in_schur_basis((2,))
[(1, (2,)), (-1, (1, 1))]
>>> monomial_in_schur_basis((2, 1))
[(1, (2, 1)), (-2, (1, 1, 1))]
>>> monomial_in_schur_basis((3,))
[(1, (3,)), (-1, (2, 1)), (1, (1, 1, 1))]
Source code in src/schur_weyl/symmetric_functions.py
def monomial_in_schur_basis(mu: tuple[int, ...]) -> list[tuple[int, tuple[int, ...]]]:
    """Expand the monomial symmetric function m_mu in the Schur basis.

    A row of inverse_kostka_matrix.

    Args:
        mu (tuple[int, ...]): The partition

    Returns:
        list[tuple[int, tuple[int, ...]]]: pairs (coefficient, nu) with m_mu = sum coefficient * s_nu

    Examples:
        >>> monomial_in_schur_basis((2,))
        [(1, (2,)), (-1, (1, 1))]
        >>> monomial_in_schur_basis((2, 1))
        [(1, (2, 1)), (-2, (1, 1, 1))]
        >>> monomial_in_schur_basis((3,))
        [(1, (3,)), (-1, (2, 1)), (1, (1, 1, 1))]
    """
    ps, table = inverse_kostka_matrix(sum(mu))
    row = table[ps.index(tuple(mu))]
    return [(c, nu) for c, nu in zip(row, ps) if c]