vectors

class laddu.utils.vectors.Vec3(px, py, pz)

A 3-momentum vector formed from Cartesian components.

Parameters:
  • px (float) – The Cartesian components of the 3-vector

  • py (float) – The Cartesian components of the 3-vector

  • pz (float) – The Cartesian components of the 3-vector

static from_array(array)

Convert an array into a 3-vector.

Parameters:

array_like – An array containing the components of this Vec3

Returns:

laddu_vec – A copy of the input array as a laddu vector

Return type:

Vec3

cross(other)

Calculate the cross product of two Vec3s.

Parameters:

other (Vec3) – A vector input with which the cross product is taken

Returns:

The cross product of this vector and other

Return type:

Vec3

dot(other)

Calculate the dot product of two Vec3s.

Parameters:

other (Vec3) – A vector input with which the dot product is taken

Returns:

The dot product of this vector and other

Return type:

float

to_numpy()

Convert the 3-vector to a numpy array.

Returns:

numpy_vec – A numpy array built from the components of this Vec3

Return type:

array_like

with_energy(mass)

Convert a 3-vector momentum to a 4-momentum with the given energy.

Parameters:

energy (float) – The mass of the new 4-momentum

Returns:

A new 4-momentum with the given energy

Return type:

Vec4

with_mass(mass)

Convert a 3-vector momentum to a 4-momentum with the given mass.

The mass-energy equivalence is used to compute the energy of the 4-momentum:

\[E = \sqrt{m^2 + p^2}\]
Parameters:

mass (float) – The mass of the new 4-momentum

Returns:

A new 4-momentum with the given mass

Return type:

Vec4

costheta

The cosine of the polar angle of this vector in spherical coordinates

\[-1 \leq \cos\theta \leq +1\]
\[\cos\theta = \frac{p_z}{|\vec{p}|}\]
mag

The magnitude of the 3-vector

\[|\vec{p}| = \sqrt{p_x^2 + p_y^2 + p_z^2}\]
mag2

The squared magnitude of the 3-vector

\[|\vec{p}|^2 = p_x^2 + p_y^2 + p_z^2\]
phi

The azimuthal angle of this vector in spherical coordinates

\[0 \leq \varphi \leq 2\pi\]
\[\varphi = \text{sgn}(p_y)\arccos\left(\frac{p_x}{\sqrt{p_x^2 + p_y^2}}\right)\]
px

The x-component of this vector

See also

Vec3.x

py

The y-component of this vector

See also

Vec3.y

pz

The z-component of this vector

See also

Vec3.z

theta

The polar angle of this vector in spherical coordinates

\[0 \leq \theta \leq \pi\]
\[\theta = \arccos\left(\frac{p_z}{|\vec{p}|}\right)\]
unit

The normalized unit vector pointing in the direction of this vector

x

The x-component of this vector

See also

Vec3.px

y

The y-component of this vector

See also

Vec3.py

z

The z-component of this vector

See also

Vec3.pz

class laddu.utils.vectors.Vec4(px, py, pz, e)

A 4-momentum vector formed from energy and Cartesian 3-momentum components.

This vector is ordered with energy as the fourth component (\([p_x, p_y, p_z, E]\)) and assumes a \((---+)\) signature

Parameters:
  • px (float) – The Cartesian components of the 3-vector

  • py (float) – The Cartesian components of the 3-vector

  • pz (float) – The Cartesian components of the 3-vector

  • e (float) – The energy component

static from_array(array)

Convert an array into a 4-vector.

Parameters:

array_like – An array containing the components of this Vec4

Returns:

laddu_vec – A copy of the input array as a laddu vector

Return type:

Vec4

boost(beta)

Boost the given 4-momentum according to a boost velocity.

The resulting 4-momentum is equal to the original boosted to an inertial frame with relative velocity \(\beta\):

\[\left[\vec{p}'; E'\right] = \left[ \vec{p} + \left(\frac{(\gamma - 1) \vec{p}\cdot\vec{\beta}}{\beta^2} + \gamma E\right)\vec{\beta}; \gamma E + \vec{\beta}\cdot\vec{p} \right]\]
Parameters:

beta (Vec3) – The relative velocity needed to get to the new frame from the current one

Returns:

The boosted 4-momentum

Return type:

Vec4

See also

Vec4.beta, Vec4.gamma

to_numpy()

Convert the 4-vector to a numpy array.

Returns:

numpy_vec – A numpy array built from the components of this Vec4

Return type:

array_like

beta

The velocity 3-vector

\[\vec{\beta} = \frac{\vec{p}}{E}\]
e

The energy associated with this vector

gamma

The relativistic gamma factor

\[\gamma = \frac{1}{\sqrt{1 - \beta^2}}\]

See also

Vec4.beta, Vec4.boost

m

The invariant mass associated with the four-momentum

\[m = \sqrt{E^2 - (p_x^2 + p_y^2 + p_z^2)}\]

See also

Vec4.mag

m2

The square of the invariant mass associated with the four-momentum

\[m^2 = E^2 - (p_x^2 + p_y^2 + p_z^2)\]

See also

Vec4.mag2

mag

The magnitude of the 4-vector

\[|p| = \sqrt{E^2 - (p_x^2 + p_y^2 + p_z^2)}\]

See also

Vec4.m

mag2

The squared magnitude of the 4-vector

\[|p|^2 = E^2 - (p_x^2 + p_y^2 + p_z^2)\]

See also

Vec4.m2

momentum

The 3-momentum part of this 4-momentum

px

The x-component of this vector

py

The y-component of this vector

pz

The z-component of this vector

t

The t-component of this vector

vec3

The 3-vector part of this 4-vector

See also

Vec4.momentum

x

The x-component of this vector

y

The y-component of this vector

z

The z-component of this vector