KaiHabermann / decayangle

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

Incorrect output when running with julia #58

Closed mmikhasenko closed 2 months ago

mmikhasenko commented 2 months ago

In the example below, the angles _23 are the angles onf the momentum p2+p3. They are clearly (0,pi) since px = 0 and py=0, while the code returns -0.92 for phi.

image

Attaching the notebook to a public gist.

I do not exclude that the problem is on Julia site. We have to reproduce the notebook in clean python session.

mmikhasenko commented 2 months ago

Btw, you do not need to download it ever, just open the pluto and put

https://gist.github.com/mmikhasenko/ee7c71ead37692f0cf4653e9c52171ea

to the address of the notebook

mmikhasenko commented 2 months ago

When both components are zero, the phi angle is pretty much undefined.

See the values below, these are the last digits of float that make the difference,

image

It's fine in general. Importantly, the rotation is consistently propagated over the chain.

mmikhasenko commented 2 months ago

What we learn is that aligning is not necessary a good thing when working with numerical methods.

btw, you mentioned that making phi=0 did not work for you, it's rather pi. The reason is the same: atan2(~0,~0) is an arbitrary number

mmikhasenko commented 2 months ago

It's not worth the effort trying to fix it, we should just avoid 0, and pi when comparing.

Let's add a line in README and close the issue.

KaiHabermann commented 2 months ago

Yes I had the same thought. Good that its cleared up though.

KaiHabermann commented 2 months ago

Maybe we could redefine it in such a way, that we rotate only theta and pick phi based on the direction of other momenta?

mmikhasenko commented 2 months ago

I think there is no other momentum that can be used

KaiHabermann commented 2 months ago

True. That Was my struggle back when I implemented this. It does not work well in rest frame :D