SquaredAmplitude

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

SquaredAmplitude

class SquaredAmplitude

A coherent amplitude square with independent ket and bra tensor indices.

State sums return new objects; an already-summed leg raises AmplitudeError. No phase-space integration, symmetry factor, flux, or state average is implicit.

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)
squared = amplitude.squared()
unpolarized = squared.sum_spins(average_initial=True).sum_colors(average_initial=True)
tensor = unpolarized.expression()

Attributes

Name Description
amplitude The original coherent amplitude and its source diagrams.
color_summed External labels whose color states have been summed.
spin_summed External labels whose spin states have been summed.

amplitude

SquaredAmplitude.amplitude: Amplitude

The original coherent amplitude and its source diagrams.

Examples

Using the setup in the SquaredAmplitude class example:

source_diagrams = squared.amplitude.diagrams

color_summed

SquaredAmplitude.color_summed: builtins.list[builtins.int]

External labels whose color states have been summed.

Examples

Using the setup in the SquaredAmplitude class example:

summed = squared.sum_colors()
assert set(summed.color_summed) == {leg.index for leg in amplitude.legs}

spin_summed

SquaredAmplitude.spin_summed: builtins.list[builtins.int]

External labels whose spin states have been summed.

Examples

Using the setup in the SquaredAmplitude class example:

summed = squared.sum_spins()
assert set(summed.spin_summed) == {leg.index for leg in amplitude.legs}

Methods

Name Description
__repr__ Describe which external states have already been summed.
_repr_html_ Render the current tensor expression with Spenso’s printer.
expression Return the current tensor expression for further Spenso simplification.
from_diagram Construct the coherent square of a single unsewn diagram.
sum_colors Sum selected color states, optionally averaging incoming states.
sum_spins Sum selected physical spin states, optionally averaging incoming states

__repr__

SquaredAmplitude.__repr__() -> builtins.str

Describe which external states have already been summed.

Examples

Using the setup in the SquaredAmplitude class example:

print(squared)

_repr_html_

SquaredAmplitude._repr_html_() -> typing.Any

Render the current tensor expression with Spenso’s printer.

Examples

Using the setup in the SquaredAmplitude class example:

from IPython.display import display
display(squared)

expression

SquaredAmplitude.expression() -> TensorExpression

Return the current tensor expression for further Spenso simplification.

Examples

Using the setup in the SquaredAmplitude class example:

tensor = squared.expression()
tensor = tensor.contract(collect_chains=False, collect_traces=False)

from_diagram

SquaredAmplitude.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,
) -> SquaredAmplitude

Construct the coherent square of a single unsewn diagram.

Examples

Using the setup in the SquaredAmplitude class example:

squared = hep.SquaredAmplitude.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.

sum_colors

SquaredAmplitude.sum_colors(
    legs: typing.Optional[typing.Sequence[builtins.int]] = None,
    *,
    average_initial: builtins.bool = False,
) -> SquaredAmplitude

Sum selected color states, optionally averaging incoming states.

Examples

Using the setup in the SquaredAmplitude class example:

color_averaged = squared.sum_colors(average_initial=True)

Parameters

  • legs (list[int] or None, optional) External labels to sum; default all remaining labels.
  • average_initial (bool, optional) Divide by the selected incoming color-space dimensions.

sum_spins

SquaredAmplitude.sum_spins(
    legs: typing.Optional[typing.Sequence[builtins.int]] = None,
    *,
    average_initial: builtins.bool = False,
    references: typing.Optional[typing.Mapping[builtins.int, Expression]] = None,
    spin_vectors: typing.Optional[typing.Mapping[builtins.int, Expression]] = None,
) -> SquaredAmplitude

Sum selected physical spin states, optionally averaging incoming states.

Omitted legs selects all unsummed legs. Omitting a massless vector reference uses the covariant sum and assumes a gauge-invariant amplitude.

Examples

Using the setup in the SquaredAmplitude class example:

unpolarized = squared.sum_spins(average_initial=True)
assert set(unpolarized.spin_summed) == {leg.index for leg in amplitude.legs}

Parameters

  • legs (list[int] or None, optional) External labels to sum; default all remaining labels.
  • average_initial (bool, optional) Divide each selected incoming completeness tensor by its state count.
  • references (dict[int, Expression] or None, optional) Unindexed axial reference momentum per selected vector leg.
  • spin_vectors (dict[int, Expression] or None, optional) Physical spin vector per selected massive Dirac leg.