LoopMomentumBasis

Symbolica documentation for getting started, symbolic expressions, numerical evaluation, pattern matching, and APIs in Python and Rust.

LoopMomentumBasis

class LoopMomentumBasis

A consistent routing of independent loop and external momenta.

Chords of the spanning tree define the loop momenta; every diagram edge is then assigned an integer MomentumSignature by momentum conservation.

Examples

from symbolica import S, E
from symbolica.community import hepkit as hep
model = hep.Model.phi4()
process = model.process(["phi", "phi"], ["phi", "phi"])
result = process.generate_diagrams(loops=1)
diagram = result.diagrams[0]
basis = diagram.loop_momentum_basis
assert len(basis.loop_edges) == diagram.loop_count
assignments = basis.edge_signatures

Attributes

Name Description
dependent_externals Return external-edge identifiers fixed by momentum conservation.
edge_signatures Return momentum signatures keyed by stable diagram edge ID.
external_edges Return the identifiers of edges attached to external states.
loop_edges Return the edge identifiers chosen as independent loop momenta.
tree_edges Return the edge identifiers belonging to the spanning tree.

dependent_externals

LoopMomentumBasis.dependent_externals: builtins.list[builtins.int]

Return external-edge identifiers fixed by momentum conservation.

Examples

Using the setup in the LoopMomentumBasis class example:

basis = diagram.loop_momentum_bases(limit=1)[0]
set(basis.dependent_externals) <= set(basis.external_edges)
True

edge_signatures

LoopMomentumBasis.edge_signatures: builtins.dict[builtins.int, MomentumSignature]

Return momentum signatures keyed by stable diagram edge ID.

Examples

Using the setup in the LoopMomentumBasis class example:

basis = diagram.loop_momentum_bases(limit=1)[0]
momentum_by_edge = {
    edge_id: signature.format_momentum()
    for edge_id, signature in basis.edge_signatures.items()
}
for edge in diagram.edges:
    print(edge.particle_name, momentum_by_edge[edge.id])

external_edges

LoopMomentumBasis.external_edges: builtins.list[builtins.int]

Return the identifiers of edges attached to external states.

Examples

Using the setup in the LoopMomentumBasis class example:

external_ids = basis.external_edges
external_routings = [basis.edge_signatures[i] for i in external_ids]

loop_edges

LoopMomentumBasis.loop_edges: builtins.list[builtins.int]

Return the edge identifiers chosen as independent loop momenta.

Examples

Using the setup in the LoopMomentumBasis class example:

basis = diagram.loop_momentum_bases(limit=1)[0]
len(basis.loop_edges) == diagram.loop_count
True

tree_edges

LoopMomentumBasis.tree_edges: builtins.list[builtins.int]

Return the edge identifiers belonging to the spanning tree.

Examples

Using the setup in the LoopMomentumBasis class example:

rerouted = diagram.with_loop_momentum_tree_edges(basis.tree_edges)

Methods

Name Description
__repr__ Return a concise description of the selected momentum basis.
_repr_html_ Return an HTML table of edge momentum assignments for notebooks.
_repr_pretty_ Write the basis summary to an IPython pretty printer.
momentum_replacements Return Symbolica Replacement objects using the same routing as numerical momenta
route Route four-momenta through every diagram edge.
route_expression Express edge momenta in this basis while retaining tensor index arguments.

__repr__

LoopMomentumBasis.__repr__() -> builtins.str

Return a concise description of the selected momentum basis.

Examples

Using the setup in the LoopMomentumBasis class example:

basis = diagram.loop_momentum_bases(limit=1)[0]
print(basis)

_repr_html_

LoopMomentumBasis._repr_html_() -> builtins.str

Return an HTML table of edge momentum assignments for notebooks.

Examples

Using the setup in the LoopMomentumBasis class example:

from IPython.display import display
display(basis)

_repr_pretty_

LoopMomentumBasis._repr_pretty_(pretty: typing.Any, cycle: builtins.bool) -> None

Write the basis summary to an IPython pretty printer.

Examples

Using the setup in the LoopMomentumBasis class example:

from IPython.lib.pretty import pretty
text = pretty(basis)

Parameters

  • pretty (Any) The IPython pretty-printer object.
  • cycle (bool) Whether this object is part of a recursive formatting cycle.

momentum_replacements

LoopMomentumBasis.momentum_replacements() -> builtins.list[typing.Any]

Return Symbolica Replacement objects using the same routing as numerical momenta. Tensor index arguments are retained on every routed vector.

Examples

Using the setup in the LoopMomentumBasis class example:

rules = diagram.loop_momentum_basis.momentum_replacements()
routed = diagram.numerator_expression().to_expression().replace_multiple(rules)

route

LoopMomentumBasis.route(
    loop_momenta: typing.Sequence[ThreeMomentum],
    external_momenta: typing.Sequence[ThreeMomentum],
) -> dict[int, ThreeMomentum]
LoopMomentumBasis.route(
    loop_momenta: typing.Sequence[FourMomentum],
    external_momenta: typing.Sequence[FourMomentum],
) -> dict[int, FourMomentum]

Route four-momenta through every diagram edge.

Examples

Using basis from the class example; zero external momenta keep this routing illustration momentum-conserving:

loop_momentum = hep.FourMomentum(2.0, 1.0, 0.0, 0.0)
external_four_momenta = [hep.FourMomentum(0.0, 0.0, 0.0, 0.0)
                         for edge in basis.external_edges]
routed = basis.route([loop_momentum], external_four_momenta)
internal_momentum = routed[basis.loop_edges[0]]

Parameters

  • loop_momenta (sequence[FourMomentum]) Independent loop momenta in basis.loop_edges order.
  • external_momenta (sequence[FourMomentum]) External momenta in basis.external_edges order.

route_expression

LoopMomentumBasis.route_expression(
    expression: TensorExpression,
    *,
    loop_momenta: typing.Optional[typing.Sequence[TensorName]] = None,
    external_momenta: typing.Optional[typing.Sequence[TensorName]] = None,
) -> TensorExpression
LoopMomentumBasis.route_expression(
    expression: Expression | int | Float | builtins.int | builtins.float | builtins.str | decimal.Decimal | ComplexFloat | Float | builtins.int | builtins.float | builtins.str | decimal.Decimal | builtins.complex | tuple[Float | builtins.int | builtins.float | builtins.str | decimal.Decimal, Float | builtins.int | builtins.float | builtins.str | decimal.Decimal],
    *,
    loop_momenta: typing.Optional[typing.Sequence[TensorName]] = None,
    external_momenta: typing.Optional[typing.Sequence[TensorName]] = None,
) -> Expression

Express edge momenta in this basis while retaining tensor index arguments.

Examples

Using the setup in the LoopMomentumBasis class example:

routed = basis.route_expression(diagram.numerator_expression().to_expression())

Parameters

  • expression (Expression or number) Expression with canonical edge momenta to route, or a scalar constant.
  • loop_momenta (sequence[TensorName] or None, optional) Vector names in loop_edges order. None retains indexed K calls.
  • external_momenta (sequence[TensorName] or None, optional) Vector names in external_edges order, excluding dependent_externals. None retains indexed P calls. Naming also applies to already routed vectors.