SquaredAmplitude
SquaredAmplitude
class SquaredAmplitudeA 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: AmplitudeThe original coherent amplitude and its source diagrams.
Examples
Using the setup in the SquaredAmplitude class example:
source_diagrams = squared.amplitude.diagramscolor_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. |
_display_ |
Present the current tensor expression with its interactive notebook display. |
_repr_html_ |
Render the current tensor expression with Spenso's printer. |
_repr_mimebundle_ |
Return the tensor expression's static and optional live representations. |
expression |
Return the current tensor expression for further Spenso simplification. |
from_diagram |
Construct the coherent square of a single unsewn diagram. |
paged |
Explore the current tensor expression with the interactive notebook pager. |
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.strDescribe which external states have already been summed.
Examples
Using the setup in the SquaredAmplitude class example:
print(squared)_display_
SquaredAmplitude._display_() -> typing.AnyPresent the current tensor expression with its interactive notebook display.
Examples
Using the setup in the SquaredAmplitude class example:
presentation = squared._display_()_repr_html_
SquaredAmplitude._repr_html_() -> typing.AnyRender the current tensor expression with Spenso's printer.
Examples
Using the setup in the SquaredAmplitude class example:
from IPython.display import display
display(squared)_repr_mimebundle_
SquaredAmplitude._repr_mimebundle_(
include: typing.Optional[typing.Sequence[builtins.str]] = None,
exclude: typing.Optional[typing.Sequence[builtins.str]] = None,
) -> typing.AnyReturn 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
include, exclude(list[str], optional) MIME types to include or exclude from the returned representations.
expression
SquaredAmplitude.expression() -> TensorExpressionReturn 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,
) -> SquaredAmplitudeConstruct 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.
paged
SquaredAmplitude.paged(
page_size: typing.Optional[builtins.int] = None,
*,
settings: typing.Optional[DisplaySettings] = None,
notation_source: typing.Optional[builtins.str] = None,
) -> typing.AnyExplore 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
page_size(int, optional) 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.settings(DisplaySettings, optional) Tensor notation, index labels, and presentation preferences.notation_source(str, optional) Unsupported by the direct MathML pager, as for TensorExpression.paged().
sum_colors
SquaredAmplitude.sum_colors(
legs: typing.Optional[typing.Sequence[builtins.int]] = None,
*,
average_initial: builtins.bool = False,
) -> SquaredAmplitudeSum 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,
) -> SquaredAmplitudeSum 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.