Amplitude
Amplitude
class AmplitudeA coherent sum of amputated, unintegrated Feynman-diagram operators.
Diagrams must describe the same external states in the same model. Named couplings are expanded; model-declared real parameters and physical momenta are real under conjugation. Complex parameters remain complex. Quadratic denominators use the graph convention without widths or an i0 prescription. Already-sewn forward diagrams are rejected.
Examples
from symbolica import S, E
from symbolica.community import hepkit as hep
model = hep.Model.phi4()
process = model.process(["phi", "phi"], ["phi", "phi"])
generated = process.generate_diagrams()
diagram = generated.diagrams[0]
amplitude = hep.Amplitude(generated.diagrams)
operator = amplitude.expression()
adjoint = amplitude.conjugate().expression()
squared = amplitude.squared().sum_spins(average_initial=True).sum_colors()
scalar = squared.expression()
scalar = scalar.contract(collect_chains=False, collect_traces=False)Attributes
| Name | Description |
|---|---|
diagrams |
Source diagrams, retaining weights, routing, and graph provenance. |
is_conjugated |
Whether this amplitude is the physical adjoint of its source diagrams. |
legs |
Physical external states in increasing external-label order. |
terms |
Individual weighted operators, with aligned external tensor ports. |
diagrams
Amplitude.diagrams: builtins.list[FeynmanDiagram]Source diagrams, retaining weights, routing, and graph provenance.
Examples
Using the setup in the Amplitude class example:
assert len(amplitude.diagrams) == len(generated.diagrams)is_conjugated
Amplitude.is_conjugated: builtins.boolWhether this amplitude is the physical adjoint of its source diagrams.
Examples
Using the setup in the Amplitude class example:
assert not amplitude.is_conjugated
assert amplitude.conjugate().is_conjugatedlegs
Amplitude.legs: builtins.list[AmplitudeLeg]Physical external states in increasing external-label order.
Examples
Using the setup in the Amplitude class example:
external_states = [(leg.index, leg.particle.name) for leg in amplitude.legs]terms
Amplitude.terms: builtins.list[TensorExpression]Individual weighted operators, with aligned external tensor ports.
Examples
Using the setup in the Amplitude class example:
operators = amplitude.terms
assert len(operators) == len(amplitude.diagrams)Methods
| Name | Description |
|---|---|
__new__ |
Sum weighted diagram operators with matching graph external indices. |
__repr__ |
Describe the retained diagrams, external states, and conjugation state. |
_repr_html_ |
Render compact diagram rows with weighted operators and expandable graphs. |
conjugate |
Conjugate scalar coefficients, color tensors, and Dirac chains |
expression |
Return the complete operator as a Spenso tensor expression. |
from_diagram |
Construct an amplitude from one complete diagram. |
squared |
Form the coherent square, including all interferences, with distinct ports |
__new__
Amplitude.__new__(
diagrams: typing.Sequence[FeynmanDiagram],
*,
dimension: typing.Optional[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]] = None,
real: typing.Optional[typing.Sequence[Expression]] = None,
) -> AmplitudeSum weighted diagram operators with matching graph external indices.
Examples
Using the setup in the Amplitude class example:
amplitude = hep.Amplitude(generated.diagrams)Parameters
diagrams(list[FeynmanDiagram]) Nonempty collection of complete, unsewn diagrams.dimension(int or Expression, optional) Lorentz dimension, default four. Bispinor spaces retain dimension four.real(list[Expression] or None, optional) Additional scalar expressions assumed real under conjugation.
__repr__
Amplitude.__repr__() -> builtins.strDescribe the retained diagrams, external states, and conjugation state.
Examples
Using the setup in the Amplitude class example:
print(amplitude)_repr_html_
Amplitude._repr_html_() -> builtins.strRender compact diagram rows with weighted operators and expandable graphs.
Examples
Using the setup in the Amplitude class example:
from IPython.display import display
display(amplitude)conjugate
Amplitude.conjugate() -> AmplitudeConjugate scalar coefficients, color tensors, and Dirac chains.
Physical external-leg labels are preserved across different fermion pairings.
Examples
Using the setup in the Amplitude class example:
adjoint = amplitude.conjugate()expression
Amplitude.expression() -> TensorExpressionReturn the complete operator as a Spenso tensor expression.
Examples
Using the setup in the Amplitude class example:
operator = amplitude.expression()from_diagram
Amplitude.from_diagram(
diagram: FeynmanDiagram,
*,
dimension: typing.Optional[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]] = None,
real: typing.Optional[typing.Sequence[Expression]] = None,
) -> AmplitudeConstruct an amplitude from one complete diagram.
Examples
Using the setup in the Amplitude class example:
amplitude = hep.Amplitude.from_diagram(diagram)Parameters
diagram(FeynmanDiagram) Complete, unsewn source diagram.dimension(int or Expression, optional) Lorentz dimension, default four.real(list[Expression] or None, optional) Additional scalar reality assumptions.
squared
Amplitude.squared() -> SquaredAmplitudeForm the coherent square, including all interferences, with distinct ports.
Spin/color sums and initial-state averages remain explicit operations.
Examples
Using the setup in the Amplitude class example:
squared = amplitude.squared().sum_spins().sum_colors()