FeynKit · latest
On this page

SquaredAmplitude

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

Member details

amplitude

Property · read-only#
amplitude: Amplitude

The original coherent amplitude and its source diagrams.

Examples

Using the setup in the SquaredAmplitude class example:

source_diagrams = squared.amplitude.diagrams

spin_summed

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

color_summed

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

from_diagram

Static method#
from_diagram(diagram: FeynmanDiagram, *, dimension: Optional[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]] = None, real: Optional[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

NameTypeDefaultDescription
diagramFeynmanDiagram—

Complete, unsewn source diagram.

dimensionOptional[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]]None

Lorentz dimension, default four.

realOptional[Sequence[Expression]]None

Additional scalar reality assumptions.

expression

Method#
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)

sum_spins

Method#
sum_spins(legs: Optional[Sequence[int]] = None, *, average_initial: bool = False, references: Optional[Mapping[int, Expression]] = None, spin_vectors: Optional[Mapping[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 requires a gauge-invariant amplitude. At most one colored massless vector leg, such as a gluon, may omit its reference across all sums of this square; otherwise AmplitudeError is raised because unphysical contributions require external ghosts. Multiple QED photons may use covariant sums under their Ward identities. This color-based guard does not establish gauge invariance for a custom model or incomplete 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

NameTypeDefaultDescription
legsOptional[Sequence[int]]None

External labels to sum; default all remaining labels.

average_initialboolFalse

Divide each selected incoming completeness tensor by its state count.

referencesOptional[Mapping[int, Expression]]None

Unindexed axial reference momentum per selected vector leg.

spin_vectorsOptional[Mapping[int, Expression]]None

Physical spin vector per selected massive Dirac leg.

sum_colors

Method#
sum_colors(legs: Optional[Sequence[int]] = None, *, average_initial: 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

NameTypeDefaultDescription
legsOptional[Sequence[int]]None

External labels to sum; default all remaining labels.

average_initialboolFalse

Divide by the selected incoming color-space dimensions.

__repr__

Method#
__repr__() -> str

Describe which external states have already been summed.

Examples

Using the setup in the SquaredAmplitude class example:

print(squared)

paged

Method#
paged(page_size: Optional[int] = None, *, settings: Optional[DisplaySettings] = None, notation_source: Optional[str] = None) -> Any

Explore the current tensor expression with the interactive notebook pager.

Examples

Using the setup in the SquaredAmplitude class example:

viewer = squared.paged()
first_page = viewer.page()

Parameters

NameTypeDefaultDescription
page_sizeOptional[int]None

None uses automatic previews: compact products may be shown completely, with 25 entries per page otherwise. An explicit size sets the maximum entries per page, between 1 and 500. Rendering budgets may show fewer.

settingsOptional[DisplaySettings]None

Tensor notation, index labels, and presentation preferences.

notation_sourceOptional[str]None

Unsupported by the direct MathML pager, as for TensorExpression.paged().

_display_

Method#
_display_() -> Any

Present the current tensor expression with its interactive notebook display.

Examples

Using the setup in the SquaredAmplitude class example:

presentation = squared._display_()

_repr_mimebundle_

Method#
_repr_mimebundle_(include: Optional[Sequence[str]] = None, exclude: Optional[Sequence[str]] = None) -> Any

Return the tensor expression's static and optional live representations.

Examples

Using the setup in the SquaredAmplitude class example:

bundle = squared._repr_mimebundle_(include=["text/html"])
html = bundle["text/html"]

Parameters

NameTypeDefaultDescription
includeOptional[Sequence[str]]None

MIME types to include or exclude from the returned representations.

excludeOptional[Sequence[str]]None

MIME types to include or exclude from the returned representations.

_repr_html_

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