sft_wick.simplify — Expression Simplification¶
Expression simplification for Wick contraction results.
Pipeline: 1. Flatten nested Sum/Product 2. Absorb rational prefactors in products 3. Eliminate zeros 4. Canonical ordering of propagators 5. Term collection (combine like terms) 6. Diagram-based collection (group by Feynman diagram isomorphism)
- sft_wick.simplify.collect_by_diagram(expr)[source]¶
Collect terms whose Feynman diagrams are isomorphic.
Groups terms that represent the same Feynman diagram under relabeling of dummy integration variables and summation indices. Factors out canonical propagators and sums coupling coefficients with appropriately permuted indices.
This correctly handles:
Spatial variable relabeling: integration variables can be freely permuted (e.g.
y_0 ↔ y_1at second order).C propagator symmetry:
C(x, y) = C(y, x).Coupling permutation: index permutations are applied to the outer coupling symbols, producing a sum of permuted couplings.
Example:
F_{i0 i1 i2} × [R_{a i2}(x,y) C_{i0 i1}(y,y) + R_{a i1}(x,y) C_{i0 i2}(y,y)]becomes:
(F_{i0 i1 i2} + F_{i0 i2 i1}) × R_{a i2}(x,y) C_{i0 i1}(y,y)
- sft_wick.simplify.collect_by_topology(expr)¶
Collect terms whose Feynman diagrams are isomorphic.
Groups terms that represent the same Feynman diagram under relabeling of dummy integration variables and summation indices. Factors out canonical propagators and sums coupling coefficients with appropriately permuted indices.
This correctly handles:
Spatial variable relabeling: integration variables can be freely permuted (e.g.
y_0 ↔ y_1at second order).C propagator symmetry:
C(x, y) = C(y, x).Coupling permutation: index permutations are applied to the outer coupling symbols, producing a sum of permuted couplings.
Example:
F_{i0 i1 i2} × [R_{a i2}(x,y) C_{i0 i1}(y,y) + R_{a i1}(x,y) C_{i0 i2}(y,y)]becomes:
(F_{i0 i1 i2} + F_{i0 i2 i1}) × R_{a i2}(x,y) C_{i0 i1}(y,y)
- sft_wick.simplify.diagonal_propagators(expr, *, diag_R=False, diag_C=False, iso_R=False, iso_C=False)[source]¶
Enforce diagonal and/or isotropic propagator constraints.
When
diag_R=True, response propagators are diagonal: \(R_{ij}(x,y) = \delta_{ij}\,R(x,y)\). This substitutes the constraint \(i = j\) into couplings and propagators, eliminating one summation index per constrained propagator.When
diag_C=True, the same is done for correlation propagators.When
iso_R=True(impliesdiag_R=True), all diagonal R entries are further assumed equal: \(R_{ii}(x,y) = R(x,y)\). The remaining component index is dropped from R propagators entirely.When
iso_C=True(impliesdiag_C=True), the same for C.- Parameters:
- Returns:
Simplified expression with the requested constraints applied.
- Return type: