ThreeMomentum

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

ThreeMomentum

class ThreeMomentum

A Cartesian spatial momentum (px, py, pz).

Three-momenta are used for boost velocities, spatial rotations, and the three-vector part of a relativistic four-momentum.

Examples

from symbolica import S, E
from symbolica.community import hepkit as hep
momentum = hep.ThreeMomentum(3.0, 4.0, 0.0)
p = momentum
first = hep.ThreeMomentum(0.0, 1.0, 0.0)
second = hep.ThreeMomentum(1.0, 0.0, 0.0)
assert momentum.pt == 5.0

Parameters

  • 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
norm Return the Euclidean norm.
norm_squared Return the squared Euclidean norm.
phi Return the azimuthal angle in radians.
pseudorapidity Return the pseudorapidity derived from the momentum direction.
pt Return the transverse-momentum magnitude.
px Return the x component.
py Return the y component.
pz Return the z component.

norm

ThreeMomentum.norm: builtins.float

Return the Euclidean norm.

Examples

Using the setup in the ThreeMomentum class example:

hep.ThreeMomentum(3.0, 4.0, 0.0).norm
5.0

norm_squared

ThreeMomentum.norm_squared: builtins.float

Return the squared Euclidean norm.

Examples

Using the setup in the ThreeMomentum class example:

hep.ThreeMomentum(3.0, 4.0, 0.0).norm_squared
25.0

phi

ThreeMomentum.phi: builtins.float

Return the azimuthal angle in radians.

Examples

Using the setup in the ThreeMomentum class example:

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

pseudorapidity

ThreeMomentum.pseudorapidity: builtins.float

Return the pseudorapidity derived from the momentum direction.

Examples

Using the setup in the ThreeMomentum class example:

abs(hep.ThreeMomentum(1.0, 0.0, 0.0).pseudorapidity) < 1e-12
True

pt

ThreeMomentum.pt: builtins.float

Return the transverse-momentum magnitude.

Examples

Using the setup in the ThreeMomentum class example:

hep.ThreeMomentum(3.0, 4.0, 12.0).pt
5.0

px

ThreeMomentum.px: builtins.float

Return the x component.

Examples

Using the setup in the ThreeMomentum class example:

assert momentum.px == 3.0

py

ThreeMomentum.py: builtins.float

Return the y component.

Examples

Using the setup in the ThreeMomentum class example:

assert momentum.py == 4.0

pz

ThreeMomentum.pz: builtins.float

Return the z component.

Examples

Using the setup in the ThreeMomentum class example:

assert momentum.pz == 0.0

Methods

Name Description
__add__ Add two spatial momenta component by component.
__mul__ Scale every spatial momentum component.
__neg__ Reverse every spatial momentum component.
__new__ Construct a Cartesian three-momentum.
__repr__ Return a constructor-style representation of the components.
__rmul__ Scale every spatial momentum component from the left.
__sub__ Subtract another spatial momentum component by component.
_repr_latex_ Render the momentum as a mathematical three-vector.
_repr_pretty_ Write the constructor-style form to an IPython pretty printer.
cross Return the vector cross product with another three-momentum.
delta_phi Return the wrapped azimuthal separation from another momentum.
delta_r Return the angular distance in pseudorapidity-azimuth space.
dot Return the Euclidean dot product with another three-momentum.
on_shell Lift this spatial momentum to an on-shell four-momentum.

__add__

ThreeMomentum.__add__(other: ThreeMomentum) -> ThreeMomentum

Add two spatial momenta component by component.

Examples

Using the setup in the ThreeMomentum class example:

total = first + second

Parameters

  • other (ThreeMomentum) Momentum to add.

__mul__

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

Scale every spatial momentum component.

Examples

Using the setup in the ThreeMomentum class example:

half_momentum = momentum * 0.5

Parameters

  • scalar (float) Multiplicative scale factor.

__neg__

ThreeMomentum.__neg__() -> ThreeMomentum

Reverse every spatial momentum component.

Examples

Using the setup in the ThreeMomentum class example:

incoming_convention = hep.ThreeMomentum(3.0, 4.0, 0.0)
outgoing_convention = -incoming_convention
assert outgoing_convention.px == -3.0

__new__

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

Construct a Cartesian three-momentum.

Examples

Using the setup in the ThreeMomentum class example:

momentum = hep.ThreeMomentum(3.0, 4.0, 0.0)

Parameters

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

__repr__

ThreeMomentum.__repr__() -> builtins.str

Return a constructor-style representation of the components.

Examples

Using the setup in the ThreeMomentum class example:

track_momentum = hep.ThreeMomentum(1.0, 2.0, 3.0)
print(f"track momentum: {track_momentum!r}")

__rmul__

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

Scale every spatial momentum component from the left.

Examples

Using the setup in the ThreeMomentum class example:

half_momentum = 0.5 * momentum

Parameters

  • scalar (float) Multiplicative scale factor.

__sub__

ThreeMomentum.__sub__(other: ThreeMomentum) -> ThreeMomentum

Subtract another spatial momentum component by component.

Examples

Using the setup in the ThreeMomentum class example:

incoming = hep.ThreeMomentum(3.0, 4.0, 0.0)
outgoing = hep.ThreeMomentum(1.0, 0.0, 0.0)
transfer = incoming - outgoing
assert transfer.px == 2.0

Parameters

  • other (ThreeMomentum) Momentum to subtract.

_repr_latex_

ThreeMomentum._repr_latex_() -> builtins.str

Render the momentum as a mathematical three-vector.

Examples

Using the setup in the ThreeMomentum class example:

latex = momentum._repr_latex_()

_repr_pretty_

ThreeMomentum._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 ThreeMomentum 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.

cross

ThreeMomentum.cross(other: ThreeMomentum) -> ThreeMomentum

Return the vector cross product with another three-momentum.

Examples

Using the setup in the ThreeMomentum class example:

hep.ThreeMomentum(1.0, 0.0, 0.0).cross(hep.ThreeMomentum(0.0, 1.0, 0.0))
ThreeMomentum(0, 0, 1)

Parameters

  • other (ThreeMomentum) Right-hand operand of the cross product.

delta_phi

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

Return the wrapped azimuthal separation from another momentum.

Examples

Using the setup in the ThreeMomentum class example:

first.delta_phi(second)
1.5707963267948966

Parameters

  • other (ThreeMomentum) Momentum whose azimuth is compared.

delta_r

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

Return the angular distance in pseudorapidity-azimuth space.

Examples

Using the setup in the ThreeMomentum class example:

separation = first.delta_r(second)
passes_isolation = separation > 0.4

Parameters

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

dot

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

Return the Euclidean dot product with another three-momentum.

Examples

Using the setup in the ThreeMomentum class example:

hep.ThreeMomentum(1.0, 0.0, 0.0).dot(hep.ThreeMomentum(2.0, 0.0, 0.0))
2.0

Parameters

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

on_shell

ThreeMomentum.on_shell(mass: typing.Optional[builtins.float] = None) -> FourMomentum

Lift this spatial momentum to an on-shell four-momentum.

Examples

Using the setup in the ThreeMomentum class example:

hep.ThreeMomentum(3.0, 4.0, 0.0).on_shell().energy
5.0

Parameters

  • mass (float, optional) On-shell mass; omitted values describe a massless momentum.