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.
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?
I encountered a few issues while solving this.
Great puzzle otherwise. Nice to see a good use of ASCII art for once.
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)).
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.
Exactly!
Iām sorry for this mistake, I am quite weak in English !
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.
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 !
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
IfG
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 ofabs(q)/m
is too far from every known particle).
An other solution would be to change the threshold .5
for a smaller value, but
What do you think?
Thank you !
Indeed, there were some mistake in the statement, sorry !
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
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
Iāll do that
Done !
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:
Thank you @pardouin and well done !
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 !
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 ! 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 !
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?