Getting the April 2024 Jane Street puzzle wrong (and crashing Mathematica)
I attempted to solve the April 2024 Jane Street puzzle, but I made some bad assumptions and did not get the correct answer.
I submitted 0.15889395849073286421
based on this computation in Mathematica:
In[1]:= N[Probability[
Sqrt[(Cos[ptheta - diff] - Cos[ptheta])^2 + (Sin[ptheta - diff] - Sin[ptheta])^2] < Abs[(Sqrt[1/2] - pradius)/pradius]
,
{
Distributed[pradius, TransformedDistribution[Sqrt[u], Distributed[u, UniformDistribution[]]]],
Distributed[ptheta, TransformedDistribution[2 Pi u, Distributed[u, UniformDistribution[]]]],
Distributed[diff, TransformedDistribution[2 Pi u, Distributed[u, UniformDistribution[]]]]
}
], 50]
Out[1]= 0.15889395849073286420654262653028487911805804181825
(takes ~30 seconds to run)
This is a bit too simple to be the answer, and indeed, the correct answer is 0.166186486474004
.
Amusingly, in the course of writing the code, I found an input that ends up crashing the Mathematica kernel after ~30 seconds:
In[1]:= Probability[
Sqrt[2 - 2 Cos[diff]] < Abs[(Sqrt[1/2] - Sqrt[pradius])/Sqrt[pradius]]
,
{
Distributed[pradius, UniformDistribution[]],
Distributed[diff, TransformedDistribution[2 Pi u, Distributed[u, UniformDistribution[]]]]
}
]
I am using Mathematica 13.2. I wonder what is going on under the hood.