symop.ccr.algebra.ket.multiply

Symbolic multiplication of CCR ket expansions.

This module provides a purely symbolic product for ket expansions represented as finite sums of ket terms.

Given

\[\lvert a \rangle \;\sim\; \sum_i c_i\, M_i, \qquad \lvert b \rangle \;\sim\; \sum_j d_j\, N_j,\]

their product is defined as the algebraic product of the underlying operator expressions,

\[\lvert a \rangle \lvert b \rangle \;\sim\; \sum_{i,j} c_i d_j \,(M_i N_j),\]

where each concatenated word \(M_i N_j\) is expanded into normal order via the CCR using symop.ccr.ket.from_word.ket_from_word().

The resulting terms are then canonicalized by merging identical monomials.

Functions

ket_multiply(a, b, *[, eps, approx, ...])

Multiply two symbolic ket expansions.

ket_multiply(a: tuple[KetTerm, ...], b: tuple[KetTerm, ...], *, eps: float = 1e-12, approx: bool = False, decimals: int = 12, ignore_global_phase: bool = False) tuple[KetTerm, ...]

Multiply two symbolic ket expansions.

The inputs represent formal sums of normally ordered monomials:

\[\lvert a \rangle \;\sim\; \sum_i c_i\, M_i, \qquad \lvert b \rangle \;\sim\; \sum_j d_j\, N_j.\]

The product is computed by expanding each concatenated word \(M_i N_j\) into normal order using ket_from_word() and accumulating the resulting terms:

\[M_i N_j \;=\; \sum_k e_{ijk}\, P_{ijk} \quad\Rightarrow\quad \lvert a \rangle \lvert b \rangle \;\sim\; \sum_{i,j,k} (c_i d_j e_{ijk})\, P_{ijk}.\]
Parameters:
  • a (tuple[KetTerm, ...]) – Left factor as a tuple of ket terms.

  • b (tuple[KetTerm, ...]) – Right factor as a tuple of ket terms.

  • eps (float) – Threshold used to skip negligible input terms and to discard negligible combined terms during canonicalization.

  • approx (bool) – If True, canonicalization merges terms using approximate monomial signatures.

  • decimals (int) – Forwarded to approximate signature selection when approx=True.

  • ignore_global_phase (bool) – Forwarded to approximate signature selection when approx=True.

Returns:

Canonicalized product expansion.

Return type:

tuple[KetTerm, …]

Notes

This routine is symbolic. It does not apply the result to a vacuum state.