FourMomentum
symbolica.community.hepkit Class
FourMomentum(energy: float, px: float, py: float, pz: float) A relativistic four-momentum in (energy, px, py, pz) order.
The class provides collider observables, invariant products, rotations, and boosts while keeping the component convention explicit.
Examples
from symbolica import S, E
from symbolica.community import hepkit as hep
momentum = hep.FourMomentum(5.0, 3.0, 4.0, 0.0)
p = momentum
first = hep.FourMomentum(5.0, 0.0, 5.0, 0.0)
second = hep.FourMomentum(5.0, 5.0, 0.0, 0.0)
assert momentum.mass_squared == 0.0Parameters
energyfloatEnergy component.
pxfloatMomentum component along the x axis.
pyfloatMomentum component along the y axis.
pzfloatMomentum component along the z axis.
Constructor
#Construct a four-momentum from energy and Cartesian spatial components.
Examples
Using the setup in the FourMomentum class example:
momentum = hep.FourMomentum(5.0, 3.0, 4.0, 0.0)Parameters
| Name | Type | Default | Description |
|---|---|---|---|
energy | float | — | Temporal component. |
px | float | — | Momentum along the x axis. |
py | float | — | Momentum along the y axis. |
pz | float | — | Momentum along the z axis. |
Member details
energy
Property · read-only#energy: floatReturn the energy component.
Examples
Using the setup in the FourMomentum class example:
assert momentum.energy == 5.0px
Property · read-only#px: floatReturn the x component of spatial momentum.
Examples
Using the setup in the FourMomentum class example:
assert momentum.px == 3.0py
Property · read-only#py: floatReturn the y component of spatial momentum.
Examples
Using the setup in the FourMomentum class example:
assert momentum.py == 4.0pz
Property · read-only#pz: floatReturn the z component of spatial momentum.
Examples
Using the setup in the FourMomentum class example:
assert momentum.pz == 0.0spatial
Property · read-only#spatial: ThreeMomentumReturn the spatial three-momentum.
Examples
Using the setup in the FourMomentum class example:
hep.FourMomentum(5.0, 3.0, 4.0, 0.0).spatial.ptmass_squared
Property · read-only#mass_squared: floatReturn the invariant mass squared.
Examples
Using the setup in the FourMomentum class example:
hep.FourMomentum(5.0, 3.0, 4.0, 0.0).mass_squaredmass
Property · read-only#mass: floatReturn the invariant mass.
Examples
Using the setup in the FourMomentum class example:
hep.FourMomentum(5.0, 0.0, 0.0, 0.0).masspt
Property · read-only#pt: floatReturn the transverse-momentum magnitude.
Examples
Using the setup in the FourMomentum class example:
hep.FourMomentum(13.0, 3.0, 4.0, 12.0).ptphi
Property · read-only#phi: floatReturn the azimuthal angle in radians.
Examples
Using the setup in the FourMomentum class example:
hep.FourMomentum(1.0, 1.0, 0.0, 0.0).phipseudorapidity
Property · read-only#pseudorapidity: floatReturn the pseudorapidity of the spatial momentum.
Examples
Using the setup in the FourMomentum class example:
abs(hep.FourMomentum(1.0, 1.0, 0.0, 0.0).pseudorapidity) < 1e-12rapidity
Property · read-only#rapidity: floatReturn the longitudinal rapidity.
Examples
Using the setup in the FourMomentum class example:
hep.FourMomentum(1.0, 1.0, 0.0, 0.0).rapiditywavefunction
Method#wavefunction(kind: str, helicity: Helicity) -> Wavefunction Construct a fixed scalar, vector or spinor external state.
kind is scalar, epsilon, epsilon_bar, u, u_bar, v or v_bar. Scalar helicity is zero; spinors use plus or minus. A massive vector also admits zero helicity for a longitudinal state. The inherited longitudinal convention is undefined at rest or zero mass and raises KinematicsError. All states use four-dimensional external components and GammaLoop's MadGraph phases; no averaging is included.
Examples
from symbolica.community import hepkit as hep
p = hep.FourMomentum(150.0, 0.0, 0.0, 150.0)
eps = p.wavefunction("epsilon", hep.Helicity.PLUS)
assert len(eps.components) == 4 and eps.bar().bar() == epsParameters
| Name | Type | Default | Description |
|---|---|---|---|
kind | str | — | Scalar, vector or spinor state kind, including the barred variants above. |
helicity | Helicity | — | Fixed helicity; zero for scalars, plus/minus for spinors, and also zero for a massive longitudinal vector with nonzero spatial momentum. |
components
Method#components() -> tuple[float, float, float, float] Return (energy, px, py, pz).
Examples
Using the setup in the FourMomentum class example:
hep.FourMomentum(5.0, 3.0, 4.0, 0.0).components()dot
Method#dot(other: FourMomentum) -> floatReturn the Minkowski dot product with another four-momentum.
Examples
Using the setup in the FourMomentum class example:
momentum.dot(momentum)Parameters
| Name | Type | Default | Description |
|---|---|---|---|
other | FourMomentum | — | Momentum to contract with this one. |
flux
Method#flux(other: Optional[FourMomentum] = None) -> float Return the decay denominator 2E or the invariant two-particle flux.
Inputs must be physical, future-directed on-shell momenta. Decay rates refer to this momentum's frame; the rest-frame result is 2M. No unit conversion, spin/color average or symmetry factor is included.
Examples
Using the setup in the FourMomentum class example:
p = hep.FourMomentum(5.0, 0.0, 0.0, 5.0)
q = hep.FourMomentum(5.0, 0.0, 0.0, -5.0)
p.flux(q)Parameters
| Name | Type | Default | Description |
|---|---|---|---|
other | Optional[ | None | Other incoming momentum; None selects a decay in this frame. |
delta_phi
Method#delta_phi(other: FourMomentum) -> floatReturn the wrapped azimuthal separation from another momentum.
Examples
Using the setup in the FourMomentum class example:
first.delta_phi(second)Parameters
| Name | Type | Default | Description |
|---|---|---|---|
other | FourMomentum | — | Momentum whose azimuth is compared. |
delta_r
Method#delta_r(other: FourMomentum) -> floatReturn the distance in rapidity-azimuth space.
Examples
Using the setup in the FourMomentum class example:
separation = first.delta_r(second)
same_jet = separation < 0.4Parameters
| Name | Type | Default | Description |
|---|---|---|---|
other | FourMomentum | — | Momentum to compare with this one. |
__add__
Method#__add__(other: FourMomentum) -> FourMomentumAdd two four-momenta component by component.
Examples
Using the setup in the FourMomentum class example:
(first + second).energy == first.energy + second.energyParameters
| Name | Type | Default | Description |
|---|---|---|---|
other | FourMomentum | — | Momentum to add. |
__sub__
Method#__sub__(other: FourMomentum) -> FourMomentumSubtract another four-momentum component by component.
Examples
Using the setup in the FourMomentum class example:
(first - second).energy == first.energy - second.energyParameters
| Name | Type | Default | Description |
|---|---|---|---|
other | FourMomentum | — | Momentum to subtract. |
__neg__
Method#__neg__() -> FourMomentumReverse the four-momentum flow convention.
Examples
Using the setup in the FourMomentum class example:
incoming_convention = hep.FourMomentum(5.0, 3.0, 4.0, 0.0)
outgoing_convention = -incoming_convention
assert outgoing_convention.energy == -5.0__mul__
Method#__mul__(scalar: float) -> FourMomentumScale every four-momentum component.
Examples
Using the setup in the FourMomentum class example:
half_momentum = momentum * 0.5Parameters
| Name | Type | Default | Description |
|---|---|---|---|
scalar | float | — | Multiplicative scale factor. |
__rmul__
Method#__rmul__(scalar: float) -> FourMomentumScale every four-momentum component from the left.
Examples
Using the setup in the FourMomentum class example:
half_momentum = 0.5 * momentumParameters
| Name | Type | Default | Description |
|---|---|---|---|
scalar | float | — | Multiplicative scale factor. |
__repr__
Method#__repr__() -> strReturn a constructor-style representation of the components.
Examples
Using the setup in the FourMomentum class example:
muon_momentum = hep.FourMomentum(5.0, 3.0, 4.0, 0.0)
print(f"muon four-momentum: {muon_momentum!r}")_repr_latex_
Method#_repr_latex_() -> strRender the momentum as a contravariant four-vector.
Examples
Using the setup in the FourMomentum class example:
latex = momentum._repr_latex_()_repr_pretty_
Method#_repr_pretty_(pretty: Any, cycle: bool) -> None Write the constructor-style form to an IPython pretty printer.
Examples
Using the setup in the FourMomentum class example:
from IPython.lib.pretty import pretty
text = pretty(momentum)Parameters
| Name | Type | Default | Description |
|---|---|---|---|
pretty | Any | — | The IPython pretty-printer object. |
cycle | bool | — | Whether this object is part of a recursive formatting cycle. |
View generated signature source: docs/api/python/feynkit-community.pyi:4246