feynlag.vertices.bilinear.expand_bilinear

feynlag.vertices.bilinear.expand_bilinear(expr)[source]

Distribute Bilinear and MajoranaBilinear over Add-valued legs.

Both atoms are linear in their two field slots (not in gamma) but are opaque custom Functions, so sp.expand() alone won’t distribute them — the same “teach SymPy about a custom operator’s linearity” need as D_linear() for PartialMu, here applied to two slots instead of one.

This is what makes fermion mass-basis rotations work: a Rotation with Indexed old fields leaves cosθ·ψ₁[i] + sinθ·ψ₂[i] sums trapped inside bilinear slots after xreplace; without distributing them, extraction would group by the un-split composite key. Both extract_fermion_vertices() and fermion_mass_matrix() / majorana_mass_matrix() apply it first.