DiagramVertex

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

DiagramVertex

class DiagramVertex

An interaction point in a Feynman diagram.

External states belong to edges; every public vertex references an interaction.

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]
vertex = diagram.vertices[0]
interaction = model.vertex_rule(vertex.interaction)
factor = vertex.numerator_expression()

Attributes

Name Description
id Return this vertex’s integer ID within the diagram.
interaction Return the interaction name
name Return the stable vertex label stored in the diagram.
numerator Return the symbolic numerator annotation as source text

id

DiagramVertex.id: builtins.int

Return this vertex’s integer ID within the diagram.

Examples

Using the setup in the DiagramVertex class example:

vertices_by_id = {item.id: item for item in diagram.vertices}

interaction

DiagramVertex.interaction: builtins.str

Return the interaction name.

Raises :class:DiagramError for an incomplete imported diagram.

Examples

Using the setup in the DiagramVertex class example:

vertex = diagram.vertices[0]
rule = model.vertex_rule(vertex.interaction)

name

DiagramVertex.name: builtins.str

Return the stable vertex label stored in the diagram.

Examples

Using the setup in the DiagramVertex class example:

vertex_names = [item.name for item in diagram.vertices]

numerator

DiagramVertex.numerator: builtins.str

Return the symbolic numerator annotation as source text.

Raises :class:DiagramError when the diagram does not carry an instantiated Feynman-rule numerator for this vertex.

Examples

Using the setup in the DiagramVertex class example:

source_text = vertex.numerator
factor = vertex.numerator_expression()

Methods

Name Description
__repr__ Return a concise, unambiguous description of the vertex.
_repr_pretty_ Write the vertex summary to an IPython pretty printer.
numerator_expression Return the numerator annotation as a Spenso TensorExpression.

__repr__

DiagramVertex.__repr__() -> builtins.str

Return a concise, unambiguous description of the vertex.

Examples

Using the setup in the DiagramVertex class example:

vertex = diagram.vertices[0]
print(vertex)  # includes its external state or interaction rule

_repr_pretty_

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

Write the vertex summary to an IPython pretty printer.

Examples

Using the setup in the DiagramVertex class example:

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

Parameters

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

numerator_expression

DiagramVertex.numerator_expression() -> TensorExpression

Return the numerator annotation as a Spenso TensorExpression.

Examples

Using the setup in the DiagramVertex class example:

vertex = diagram.vertices[0]
vertex_factor = vertex.numerator_expression()
weighted_vertex_factor = diagram.overall_factor_expression() * vertex_factor