[Community Puzzle] Particle Detection with Cloud Chamber

https://www.codingame.com/training/medium/particle-detection-with-cloud-chamber

Send your feedback or ask for help here!

Created by @LaurentValade,validated by @Marchete,@Fluxor and @LastRick.
If you have any issues, feel free to ping them.

Really unique puzzle, was fun to code and approve. But Iā€™m having issues now with Validator 1 (all tests and other validators pass). Is Val 1 still the straight line shown on the contribute page?

1 Like

I encountered a few issues while solving this.

  • the statement requests rounding to the tenth, yet all test/validator outputs are integral
  • I find a very different radius for test 6 (55 vs 60). I work around it by recomputing the radius from the known particle properties, but itā€™s unclear this is what is asked. (seems to impact validators 4 and 6)
  • the relative g error formula threshold of 0.5 consistently confuses protons and alpha. Using 0.4 or picking best match works around it, butā€¦ why give a specific formula if it canā€™t work?

Great puzzle otherwise. Nice to see a good use of ASCII art for once.

3 Likes

Same for point 2, I used a statistical approach and ended up filtering the points aggressively (sigma <= 2) to get results in line with the expected output.
Also same for point 3, in that case I simply took the particule with the least error (closest to 0) and it worked, but thatā€™s not something covered in the description.

I imagine the difference in radius for Test 6 is due to the issue in your first line. The confusion comes from the author using the word ā€œtenthā€. Here, it doesnā€™t mean ā€œ0.1ā€ (to the right of the decimal); instead it means ā€œto the nearest multiple of tenā€. Something like "10*(int(radius/10)).

1 Like

If the radius is computed correctly (see my other note), you shouldnā€™t need that kind of check on least error. In my code (Dart), I found that using StringAsFixed(4) is enough accuracy to match the q/m values in the table.

For test 4 you do. If you use the correct radius of 60 you get a value of 0.49664609605580906 for the proton, and 2.0204107484267375e-16 for the alpha particle. Both are strictly under 0.5.

Not sure where those values are coming from. According to the table, g = Q/m, which for alpha is around 0.005 (2/3727), while proton Q/m is 0.001 (much smaller). Using R = 60 in the gammaV BRC equation (right side of the equation), g ~ 0.005. My code is literally a stack of if-statements like:
g.toStringAsFixed(4) == (2/3727).toStringAsFixed(4)
and this is enough to pass the tests.

Well, except Validator 1. Would love to know why I canā€™t get past that.

The formula for G is 1e6 * V / (B * R * c * ((1 - V ** 2) ** 0.5)), for a radius of 60 that gives you 0.000536624631070566.
The proton has a g_p value of abs(charge) / mass which is 0.0010660980810234541
If you compute the final formula abs(g_p - G) / g_p you get 0.49664609605580906.

I assume that your calls to toStringAsFixed are doing some rounding and thatā€™s why you may not get the same result.

1 Like

Exactly!
Iā€™m sorry for this mistake, I am quite weak in English :disappointed_relieved: !
I would like to correct it, but I donā€™t know if I can still edit a puzzle after its approvalā€¦

You can edit your puzzle from its contribution page, even after its approval.

1 Like

Hi Djoums,
I am not sure to understand where your problem came from, maybe it is because of my error in the statement with Ā«nearest tenthĀ» instead ef Ā«the nearest multiple of 10Ā».
Before writing this answer, I was sure that the abs(q)/m particle interval does not overlap as I choose the value .5 for the threshold of abs(g_p - G) / G such as, but my bad, abs(q)/m interval of proton and alpha overlap :expressionless: :rage: :pleading_face: :cry: :thinking: !

e-   : q = -1, m =    0.511  ==>  abs(q)/m =     1.96  :  G āˆˆ [   0.978,     2.94]
p+   : q =  1, m =  938.000  ==>  abs(q)/m =  0.00107  :  G āˆˆ [0.000533,   0.0016]
n0   : q =  0, m =  940.000  ==>  abs(q)/m =        0  :  G āˆˆ [       0,        0]
alpha: q =  2, m = 3727.000  ==>  abs(q)/m = 0.000537  :  G āˆˆ [0.000268, 0.000805]
pi+  : q =  1, m =  140.000  ==>  abs(q)/m =  0.00714  :  G āˆˆ [ 0.00357,   0.0107]

I took this criterion as a detail, but the devil is in the details!

So maybe I should change the statement

Likewise, the ratio g = |q|/m could not be computed exactly. Letā€™s note g_p the theoritical value of particle p (given in the table below) and G the computed value from picture with the formula above.
If
abs(g_p - G) / g_p < .5
one can conclude that the particle which just passed through the cloud chamber was p .
If none of the five known particle satifies
abs(g_p - G) / g_p < .5
one can conclude that the particle which just passed through the cloud chamber is unknown.

for

Likewise, the ratio g = |q|/m could not be computed exactly. Letā€™s note g_p the theoritical value of particle p (given in the table above) and G the computed value from ASCII-art picture with the formula above.
The particle p which just passed through the cloud chamber is the one with the minimal value of
abs(g_p - G) / g_p
if this value is stricly below .5, i.e. :
abs(g_p - G) / g_p < .5
If G is such that
abs(g_p - G) / g_p >= .5
for every known particles (those in the table above), one can conclude that the particle which just passed through the cloud chamber is unknown (as its value of abs(q)/m is too far from every known particle).

An other solution would be to change the threshold .5 for a smaller value, but

  • it would make the game a lot harder because a better precision on the computed radius would be needed,
  • it would not be backward compatible for the test/validator.

What do you think?

Thank you :slight_smile: !
Indeed, there were some mistake in the statement, sorry :worried: !
About your first point, as explained by @LastRick I wrote Ā«closest tenthĀ» instead of Ā«nearest multiple of 10Ā».
About your second and third point, the statement was indeed unclear and ambiguous, see my answer to @Djoums :
[Community Puzzle] Particle Detection with Cloud Chamber

2 Likes

I think itā€™s fine to take the particle with the lowest ratio, thatā€™s what I did intuitively. Mentionning it in the description like you proposed would be enough :slightly_smiling_face:

1 Like

Iā€™ll do that :slight_smile:

Done :slight_smile: !

I really enjoyed this one, even tho it all comes to finding the center of a circle, the context is original.

I didnā€™t use any statistics, just chose three points on the circle and deduced the center from that.

To make sure the three points are not too close from each other (which would mess the precision), I do the following:

  • choose any point A on the circle
  • choose a point B on the circle that maximizes AB
  • choose a point C on the circle that maximizes AC x BC
1 Like

Thank you @pardouin and well done :smiley:!
The 3 points solution is much simpler that the overkill mine that use gradient descent along the greatest steep. My wife solved it with this method too :smiley:!
I created this puzzle with the idea that one use every points of the particle path to use all the information given, but three points well chosen are enough :exploding_head: ! After a little bit of disapointment, I am happy that you and others (including my wife) have found a simpler solution; simpler is better, faster, stronger !

I am very glad that my puzzle is puzzle of the week this week :smiley: !

4 Likes

Iā€™m struggling with the hidden validator #6.

I get the radius much like pardouin does in the 3 steps.

Initially I looped through known particles finding their radius and assigned the difference between expected radius and actual radius that they would have under the current circumstances. Then I filtered to those under a certain threshold and sorted by value ascending.
This worked, however I wasnā€™t passing hidden validator #6 (all visible tests were passing).

I went back and read the assignment several more times and then I think I did understand it, however I still fail on hidden validator #6. What I do is: for each known particle I create a g_p and G

    g_p = abs(q)/m;
    G = 1e6 * (1/sqrt(1-V*V)) * V / (B * r * c);

and assign each particle a ratio using abs(g_p-G)/g_p)
then I filter all of particles with ratio > 0.5 and sort them by lowest being mindful of neutron exception.

Passing all visible tests yet still failing on hidden validator #6.
Am I missing something?