FeynKit · latest
On this page

LoopMomentumBasis

symbolica.community.hepkit 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

Member details

tree_edges

Property · read-only#
tree_edges: list[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)

loop_edges

Property · read-only#
loop_edges: list[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

external_edges

Property · read-only#
external_edges: list[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]

dependent_externals

Property · read-only#
dependent_externals: list[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)

edge_signatures

Property · read-only#
edge_signatures: dict[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])

momentum_replacements

Method#
momentum_replacements() -> list[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)

__repr__

Method#
__repr__() -> 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_

Method#
_repr_html_() -> 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_

Method#
_repr_pretty_(pretty: Any, cycle: 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

NameTypeDefaultDescription
prettyAny—

The IPython pretty-printer object.

cyclebool—

Whether this object is part of a recursive formatting cycle.

route_expression

Method#

Overloads

Overload 1 #
route_expression(expression: TensorExpression, *, loop_momenta: Optional[Sequence[TensorName]] = None, external_momenta: Optional[Sequence[TensorName]] = None) -> TensorExpression

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
NameTypeDefaultDescription
expressionTensorExpression—

Expression with canonical edge momenta to route, or a scalar constant.

loop_momentaOptional[Sequence[TensorName]]None

Vector names in loop_edges order. None retains indexed K calls.

external_momentaOptional[Sequence[TensorName]]None

Vector names in external_edges order, excluding dependent_externals. None retains indexed P calls. Naming also applies to already routed vectors.

Overload 2 #
route_expression(expression: Expression | int | Float | int | float | str | decimal.Decimal | ComplexFloat | Float | int | float | str | decimal.Decimal | complex | tuple[Float | int | float | str | decimal.Decimal, Float | int | float | str | decimal.Decimal], *, loop_momenta: Optional[Sequence[TensorName]] = None, external_momenta: Optional[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
NameTypeDefaultDescription
expressionExpression | int | Float | int | float | str | decimal.Decimal | ComplexFloat | Float | int | float | str | decimal.Decimal | complex | tuple[Float | int | float | str | decimal.Decimal, Float | int | float | str | decimal.Decimal]—

Expression with canonical edge momenta to route, or a scalar constant.

loop_momentaOptional[Sequence[TensorName]]None

Vector names in loop_edges order. None retains indexed K calls.

external_momentaOptional[Sequence[TensorName]]None

Vector names in external_edges order, excluding dependent_externals. None retains indexed P calls. Naming also applies to already routed vectors.

route

Method#

Overloads

Overload 1 #
route(loop_momenta: Sequence[ThreeMomentum], external_momenta: Sequence[ThreeMomentum]) -> dict[int, ThreeMomentum]

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
NameTypeDefaultDescription
loop_momentaSequence[ThreeMomentum]—

Independent loop momenta in basis.loop_edges order.

external_momentaSequence[ThreeMomentum]—

External momenta in basis.external_edges order.

Overload 2 #
route(loop_momenta: Sequence[FourMomentum], external_momenta: 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
NameTypeDefaultDescription
loop_momentaSequence[FourMomentum]—

Independent loop momenta in basis.loop_edges order.

external_momentaSequence[FourMomentum]—

External momenta in basis.external_edges order.