Skip to content

Issue with 4D dot product? #149

@jpivarski

Description

@jpivarski

Discussed in #147

Originally posted by wcosyn October 27, 2021
I was using the package to do some relativistic kinematics calculations and noticed the following strange behavior. I would assume the 4D dot product to be the Lorentz inner product (so metric ---+), but it seems for some situations it reverts to a Cartesian inner product (metric ----). I would assume this is a bug as I wouldn't expect this sort of behavior or saw anything mentioned in the documentation that would explain it.

Here is an example that at least on my system shows the behavior. Simply flipping the sign of the fourvector SmuT yields the Cartesian instead of the Lorentz inner product. As a note, SmuT is constructed such that it is a spatial unit vector and (SmuT*P) should be zero.

import numpy as np
import vector

Ep = 275 #GeV
massp = 0.938 # GeV
theta_c = 25.*1.E-03
ppnorm = np.sqrt(Ep*Ep-massp*massp)

pp = vector.obj(pz=ppnorm*np.cos(theta_c),px=-ppnorm*np.sin(theta_c),py=0.,E=Ep)

pp_plus = pp.E+pp.pz

S_min = 2.*pp.px/(pp.E+pp.pz)
SmuT = vector.obj(E=0.5*(S_min),px=1.,py=0.,pz=0.5*(-S_min))

print("ST^2",SmuT.M2)
print("S dot P Lorentz", pp.dot(SmuT),-pp.dot(-SmuT))
print("Cartesian+: ",pp.E*SmuT.E+pp.px*SmuT.px+pp.py*SmuT.py+pp.pz*SmuT.pz)

Output:

ST^2 -1.0
S dot P Lorentz 6.875338094560275 -4.440892098500626e-16
Cartesian+: -6.875338094560275

I get similar behaviour in other situations, where changing some components of fourvectors flips a Lorentz inner product to a Cartesian one, seemingly at random.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThe problem described is something that must be fixed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions