symop.ccr.algebra.ket.identity_coeff

Identity-coefficient extraction for CCR ket expansions.

This module provides helpers to extract the scalar (identity) component from a normally ordered ket-term expansion.

Given

\[\lvert \psi \rangle \;\sim\; \sum_k c_k\, M_k,\]

the identity coefficient corresponds to the term where

\[M_k = \mathbb{I},\]

i.e. the monomial has no creation or annihilation operators.

This scalar term typically arises from commutator contractions in normal ordering and represents the c-number component of the expansion.

Functions

identity_coeff(terms)

Return the coefficient of the identity monomial.

identity_coeff(terms: tuple[KetTerm, ...]) complex

Return the coefficient of the identity monomial.

Parameters:

terms (tuple[KetTerm, ...]) – Tuple of ket terms forming a normally ordered expansion.

Returns:

The coefficient associated with the identity monomial (no creators and no annihilators). Returns 0.0 + 0.0j if no identity term is present.

Return type:

complex

Notes

  • The identity term represents the scalar contribution of an operator expansion after commutator contractions.

  • If multiple identity terms exist (which should not occur after canonicalization), the first match is returned.