KaiHabermann / decayangle

https://kaihabermann.github.io/decayangle/
MIT License
1 stars 1 forks source link

Numerical issues with 2pi: phi vs psi #34

Closed mmikhasenko closed 6 months ago

mmikhasenko commented 6 months ago

Here is a test of continuity: momenta orientation is obtained by rotating Rz(phi)Ry(theta)Rz(psi) of a fixed aligned kinematics. The theta is fixed, phi, and psi are x, and y.

Wigner azimuthal angle for relative tree2 with respect to tree1 is plotted

image

the jumps are 2pi subtractions.

What is the issue?

numerical fluctuation cause random distribution of the compensation phase +2pi between phi and psi.

Practical checks

mmikhasenko commented 6 months ago

It's not an issue in the overall transformation, rather for the individual angle psi - it jumps together with phi changing from -pi to pi. The sum of the two is continuous

image
result_psi = result_full[1].psi_rf
result_phi = result_full[1].phi_rf + np.pi
result = result_psi + result_phi
KaiHabermann commented 6 months ago

Ill look at this in more detail tomorrow. If you are at it right now, can you see, if this behaviour changes for different theta? Or is it unrelated to theta?

mmikhasenko commented 6 months ago

Pattern is slightly different. I would say it is merely related to theta: since +- 2pi lives in the numerical precision domain, any fluctuation causes the jump, It can be phi, can be theta

mmikhasenko commented 6 months ago

Finally found the interesting stuff, that I was trying to do: the physical angle jump due to mismatch of domain of kinematic variables.

The helicity angles, (phi, theta), (psi, ...) appear in all topologies. Every topology folds the SU(2) space (4pi x 2 x 4pi -> 2pi x 2 x 2pi) differently. Wigner rotations are responsible for matching the topologies on SU(2).

Below one sees the border of 2pi flip domains for wigner psi_3(1)_for1.

The local numerical jumps are destructing, therefore I plot phi+psi. It's not yet clear to me why I have to do phi-psi for the corner regions.

(phi-psi)

image

(phi+psi)

image

Anyway, the effect that should be there is clearly visible.

mmikhasenko commented 6 months ago

Realized over the night that remaining jumps for psi+phi is the 4pi, it's not an issue, 4pi is true a ambiguity. Simply to remove by forsoing, [-pi, 3pi] range for the angles

mmikhasenko commented 6 months ago

@KaiHabermann added notes in the header of the issue.

KaiHabermann commented 6 months ago

I added an fmod by 4 pi to tthe image. Now it is smooth in both areas, but different. phi + psi with fmod(phi +psi + 4pi , 4pi) test psi test_psi phi test_phi

KaiHabermann commented 6 months ago

@mmikhasenko should I show the above plot (the nice one) in the talk?

mmikhasenko commented 6 months ago

Yes, would be nice

KaiHabermann commented 6 months ago

test_psi test test_phi

Final Version after the + 2 pi was moved to phi instead of psi. This removed the numerical instability for the 3body case (undetermined psi)

Closing this issue, as the latest release solves it

KaiHabermann commented 6 months ago

test test_phi test_psi