symop.ccr.algebra.ket.apply¶
Apply operator words to symbolic kets.
A symbolic ket is represented as a finite linear combination of normally-ordered monomials,
where each \(M_k\) is a normally-ordered monomial in ladder operators.
This module implements left-multiplication by an operator word
acting as \(\lvert \psi \rangle \mapsto W \lvert \psi \rangle\), and also the action of a linear combination of words.
Functions
|
Apply a single operator word to a symbolic ket. |
|
Apply a linear combination of operator words to a ket. |
- ket_apply_word(ket: tuple[KetTerm, ...], word: Iterable[LadderOp], *, eps: float = 1e-12) tuple[KetTerm, ...]¶
Apply a single operator word to a symbolic ket.
The operator word (an ordered sequence of ladder operators) is expanded into a normally-ordered ket via
ket_from_word(). The resulting expansion is then multiplied with the inputketusingket_multiply(), yielding the normally-ordered result of left multiplication by the given operator product.- Parameters:
- Returns:
The resulting ket terms, normally ordered.
- Return type:
tuple[KetTermProto, …]
Notes
This performs symbolic normal ordering only; no matrix representation is involved.
- ket_apply_words_linear(ket: tuple[KetTerm, ...], terms: Iterable[tuple[complex, Iterable[LadderOp]]], *, eps: float = 1e-12) tuple[KetTerm, ...]¶
Apply a linear combination of operator words to a ket.
For each pair
(c, word)interms, this computesket_apply_word()and scales the result byc. All partial results are concatenated and canonicalized usingcombine_like_terms_ket().- Parameters:
- Returns:
The resulting ket terms, combined into a canonical form.
- Return type:
tuple[KetTermProto, …]