FourMomentum

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

FourMomentum

class FourMomentum

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.0

Parameters

  • energy (float) Energy component.
  • px (float) Momentum component along the x axis.
  • py (float) Momentum component along the y axis.
  • pz (float) Momentum component along the z axis.

Attributes

Name Description
energy Return the energy component.
mass Return the invariant mass.
mass_squared Return the invariant mass squared.
phi Return the azimuthal angle in radians.
pseudorapidity Return the pseudorapidity of the spatial momentum.
pt Return the transverse-momentum magnitude.
px Return the x component of spatial momentum.
py Return the y component of spatial momentum.
pz Return the z component of spatial momentum.
rapidity Return the longitudinal rapidity.
spatial Return the spatial three-momentum.

energy

FourMomentum.energy: builtins.float

Return the energy component.

Examples

Using the setup in the FourMomentum class example:

assert momentum.energy == 5.0

mass

FourMomentum.mass: builtins.float

Return the invariant mass.

Examples

Using the setup in the FourMomentum class example:

hep.FourMomentum(5.0, 0.0, 0.0, 0.0).mass
5.0

mass_squared

FourMomentum.mass_squared: builtins.float

Return the invariant mass squared.

Examples

Using the setup in the FourMomentum class example:

hep.FourMomentum(5.0, 3.0, 4.0, 0.0).mass_squared
0.0

phi

FourMomentum.phi: builtins.float

Return the azimuthal angle in radians.

Examples

Using the setup in the FourMomentum class example:

hep.FourMomentum(1.0, 1.0, 0.0, 0.0).phi
0.0

pseudorapidity

FourMomentum.pseudorapidity: builtins.float

Return 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-12
True

pt

FourMomentum.pt: builtins.float

Return the transverse-momentum magnitude.

Examples

Using the setup in the FourMomentum class example:

hep.FourMomentum(13.0, 3.0, 4.0, 12.0).pt
5.0

px

FourMomentum.px: builtins.float

Return the x component of spatial momentum.

Examples

Using the setup in the FourMomentum class example:

assert momentum.px == 3.0

py

FourMomentum.py: builtins.float

Return the y component of spatial momentum.

Examples

Using the setup in the FourMomentum class example:

assert momentum.py == 4.0

pz

FourMomentum.pz: builtins.float

Return the z component of spatial momentum.

Examples

Using the setup in the FourMomentum class example:

assert momentum.pz == 0.0

rapidity

FourMomentum.rapidity: builtins.float

Return the longitudinal rapidity.

Examples

Using the setup in the FourMomentum class example:

hep.FourMomentum(1.0, 1.0, 0.0, 0.0).rapidity
0.0

spatial

FourMomentum.spatial: ThreeMomentum

Return the spatial three-momentum.

Examples

Using the setup in the FourMomentum class example:

hep.FourMomentum(5.0, 3.0, 4.0, 0.0).spatial.pt
5.0

Methods

Name Description
__add__ Add two four-momenta component by component.
__mul__ Scale every four-momentum component.
__neg__ Reverse the four-momentum flow convention.
__new__ Construct a four-momentum from energy and Cartesian spatial components.
__repr__ Return a constructor-style representation of the components.
__rmul__ Scale every four-momentum component from the left.
__sub__ Subtract another four-momentum component by component.
_repr_latex_ Render the momentum as a contravariant four-vector.
_repr_pretty_ Write the constructor-style form to an IPython pretty printer.
components Return (energy, px, py, pz).
delta_phi Return the wrapped azimuthal separation from another momentum.
delta_r Return the distance in rapidity-azimuth space.
dot Return the Minkowski dot product with another four-momentum.
flux Return the decay denominator 2E or the invariant two-particle flux

__add__

FourMomentum.__add__(other: FourMomentum) -> FourMomentum

Add two four-momenta component by component.

Examples

Using the setup in the FourMomentum class example:

(first + second).energy == first.energy + second.energy
True

Parameters

  • other (FourMomentum) Momentum to add.

__mul__

FourMomentum.__mul__(scalar: builtins.float) -> FourMomentum

Scale every four-momentum component.

Examples

Using the setup in the FourMomentum class example:

half_momentum = momentum * 0.5

Parameters

  • scalar (float) Multiplicative scale factor.

__neg__

FourMomentum.__neg__() -> FourMomentum

Reverse 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

__new__

FourMomentum.__new__(
    energy: builtins.float,
    px: builtins.float,
    py: builtins.float,
    pz: builtins.float,
) -> FourMomentum

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

  • 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.

__repr__

FourMomentum.__repr__() -> builtins.str

Return 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}")

__rmul__

FourMomentum.__rmul__(scalar: builtins.float) -> FourMomentum

Scale every four-momentum component from the left.

Examples

Using the setup in the FourMomentum class example:

half_momentum = 0.5 * momentum

Parameters

  • scalar (float) Multiplicative scale factor.

__sub__

FourMomentum.__sub__(other: FourMomentum) -> FourMomentum

Subtract another four-momentum component by component.

Examples

Using the setup in the FourMomentum class example:

(first - second).energy == first.energy - second.energy
True

Parameters

  • other (FourMomentum) Momentum to subtract.

_repr_latex_

FourMomentum._repr_latex_() -> builtins.str

Render the momentum as a contravariant four-vector.

Examples

Using the setup in the FourMomentum class example:

latex = momentum._repr_latex_()

_repr_pretty_

FourMomentum._repr_pretty_(pretty: typing.Any, cycle: builtins.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

  • pretty (object) The IPython pretty-printer object.
  • cycle (bool) Whether this object is part of a recursive formatting cycle.

components

FourMomentum.components() -> tuple[builtins.float, builtins.float, builtins.float, builtins.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()
(5.0, 3.0, 4.0, 0.0)

delta_phi

FourMomentum.delta_phi(other: FourMomentum) -> builtins.float

Return the wrapped azimuthal separation from another momentum.

Examples

Using the setup in the FourMomentum class example:

first.delta_phi(second)
1.5707963267948966

Parameters

  • other (FourMomentum) Momentum whose azimuth is compared.

delta_r

FourMomentum.delta_r(other: FourMomentum) -> builtins.float

Return the distance in rapidity-azimuth space.

Examples

Using the setup in the FourMomentum class example:

separation = first.delta_r(second)
same_jet = separation < 0.4

Parameters

  • other (FourMomentum) Momentum to compare with this one.

dot

FourMomentum.dot(other: FourMomentum) -> builtins.float

Return the Minkowski dot product with another four-momentum.

Examples

Using the setup in the FourMomentum class example:

momentum.dot(momentum)
0.0

Parameters

  • other (FourMomentum) Momentum to contract with this one.

flux

FourMomentum.flux(other: typing.Optional[FourMomentum] = None) -> builtins.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)
200.0

Parameters

  • other (FourMomentum | None) Other incoming momentum; None selects a decay in this frame.