Monday, October 14, 2024

Leading the logarithmic pack

You’re doing a $30$-minute workout on your stationary bike. There’s a live leaderboard that tracks your progress, along with the progress of everyone else who is currently riding, measured in units of energy called kilojoules. Once someone completes their ride, they are removed from the leaderboard.

Suppose many riders are doing the $30$-minute workout right now, and that they all begin at random times. Further suppose that they are burning kilojoules at different constant rates (i.e., everyone is riding at constant power) that are uniformly distributed between $0$ and $200$ Watts.

Halfway through (i.e., $15$ minutes into) your workout, you notice that you’re exactly halfway up the leaderboard. How far up the leaderboard can you expect to be as you’re finishing your workout?

Let's start by determining the distribution of the random other riders' outputs at any one time. At any particular time, say $\tau$, the only riders still on the leaderboard would have started at times $t \in (\tau - 1800, \tau).$ Let's assume that riders join the $30$ minute class uniformly randomly such that the probability that any join between the time $t$ and $t+dt$ is proportional to $dt,$ that is, at time \tau, the riders would have already completed $T \sim U(0,1800)$ seconds of the rider. These riders would also have uniformly distribution constant powers, $P \sim U(0,200).$ The total output is $O = P \cdot T,$ which we can get the distribution of by directly computing the \begin{align*}\mathbb{P} \{ O \leq \theta \} &= \frac{1}{360000}\int_0^{200} \int_0^{1800} \chi \{ p t \leq \theta \} \,dt \,dp \\ &= \frac{1}{360000} \int_0^{200} \int_0^{\min \{ 1800, \theta / p \}} \,dt \,dp \\ &= \frac{1}{360000} \int_0^{200} \min \left\{1800, \frac{\theta}{p} \right\} \,dp \\ &= \frac{1}{360000} \left( \int_0^{\theta/1800} 1800 \,dp + \int_{\theta / 1800}^200 \frac{\theta}{p} \,dp \right) \\ &= \frac{1}{360000} \left( \theta + \theta \left( \ln 200 - \ln (\theta / 1800) \right) \right) \\ &= \frac{\theta}{360000} \left( 1- \ln \left( \frac{\theta}{360000} \right) \right).\end{align*}

So let's simplify slightly and focus on the function $\Phi(t) = t ( 1 - \ln t ).$ So in particular, if at some point I find myself half way up the leaderboard, then that would mean that my output $\tilde{O} = 360000 \tilde{\theta}$ where $\Phi(\tilde{\theta}) = \frac{1}{2}.$ Of course, $\Phi$ does not have a neat and tidy inverse function, so we would have to implicitly solve for $\tilde{\theta} = \Phi^{-1}(0.5),$ but more on this later.

So since the distribution of random riders is time invariant, if halfway through my ride I have output $\tilde{O} = 360000 \Phi^{-1}(0.5),$ then I can expect my output at end of my ride I have output $2\tilde{O}.$ In this case, the proportion of riders that I will be ahead of the leaderboard is \begin{align*}\Phi(2 \Phi^{-1}(0.5)) &= 2\Phi^{-1}(0.5) \left( 1- \ln (2\Phi^{-1}(0.5))\right) \\ &= 2 \Phi^{-1}(0.5) \left( 1- \ln 2 - \ln \Phi^{-1}(0.5) \right) \\ &= -2 \Phi^{-1}(0.5) \ln 2 + 2 \Phi^{-1} (0.5) \left( 1 - \ln \Phi^{-1}(0.5) \right) \\ &= -2 \Phi^{-1}(0.5) \ln 2 + 2 \Phi \left( \Phi^{-1}(0.5) \right) \\ &= 1 - 2 \Phi^{-1}(0.5) \ln 2 = 1 - 2 \tilde{\theta} \ln 2 .\end{align*} So, since we can analytically solve the inverse function to find that $\tilde{\theta} = \Phi^{-1}(0.5) = 0.1866823,$ I can expect to be ahead of about $$1-2 \tilde{\theta} \ln 2 \approx 74.1203380189...\%$$ of the riders at the end of my ride.

As an added bonus problem (though not quite Extra Credit), what’s the highest up the leaderboard you could expect to be $15$ minutes into your workout?

If I am killing it at 200 Watts for the first 15 minutes, then I would have an output of $\hat{O} = 200 \cdot 900 = 180000$ kJ, which would put me ahead of about $$\Phi\left(\frac{\hat{O}}{360000}\right) = \Phi(0.5) = 0.5 (1 + \ln 2) \approx 84.657359028...\%$$ of the riders after $15$ minutes.

No comments:

Post a Comment