Sunday, July 12, 2026

The one where they end up at the same place

The climber and the sprinter are racing up a perfectly sinusoidal hill. They go from the base, where the gradient is 0 percent, to the peak, where the gradient is again 0 percent. For them to reach the top at the same time, what should the maximum gradient of the hill be?

Ok, so a few things are left unstated here, so let's insert them. Let's assume that the horizontal distance of this hill section is 1, since units don't seem to matter in the slightest at Tour de Fiddler. Since we know that the hill is perfectly sinusoidal, we see that the height at horizontal distance $x \in [0,1]$ from the start is given by $$h(x) = \frac{h}{2} + \frac{h}{2} \sin \left( \pi x - \frac{\pi}{2} \right) = \frac{h}{2} \left(1 - \cos (\pi x) \right),$$ where $h$ is the total height of the hill. In particular, we additionally see that the gradient at a vertical distance of $x$ from the start is given by $$g(x) = h^\prime (x) = \frac{\pi h}{2} \sin (\pi x).$$ So like the Classic problem we will solve the problem with respect to one variable, in this case the height $h,$ and then transform it into the desired variable, in this case $$g_{max} = \max_{x \in [0,1]} \frac{\pi h}{2} \sin(\pi x) = \frac{\pi h}{2}.$$

In order to figure out the time elapsed for a rider, we might first want to chop the horizontal distance into say $N$ small pieces, say with $x_n = \frac{n}{N},$ for $n = 0, 1, \dots, N.$ In this case, we can determine for each short segment of horizontal distance from say $x_{n-1}$ to $x_n,$ what the horizontal inclination $\theta_n$ is, in order to determine the speed of the rider over that small interval $v_n = v(\theta_n).$ Then we see that since $v_n$ represents the total speed, that the horizontal speed is only $v_n \cos \theta_n,$ so that the time it would take for the rider to traverse the small segment would be $$t_n = \frac{x_{n+1} - x_n}{ v_n \cos \theta_n} = \frac{1}{N v_n \cos \theta_n}.$$ Then the total time elapsed is \begin{align*}T = \sum_{n=1}^{N} t_n = \sum_{n=1}^N \frac{1}{N (v_n \cos \theta_n)} &\to \int_0^1 \frac{dx}{ v(\theta(x)) \cos \theta(x) } \\ &= \int_0^1 \frac{dx}{ \frac{P}{m \sin \theta(x) + 10} \cos \theta(x) } \\ &= \frac{1}{P} \int_0^1 \left(m \tan \theta(x) + 10 \sec \theta(x) \right) \,dx \end{align*} as $N \to \infty.$

Since $$\theta(x) = \tan^{-1} g(x) = \tan^{-1} h^\prime(x) = \tan^{-1} \left( \frac{\pi h}{2} \sin (\pi x) \right),$$ we have $$T(h) = \frac{1}{P} \int_0^1 \left( m \tan \left( \tan^{-1} \left( \frac{\pi h}{2} \sin (\pi x) \right) \right) + 10 \sec \left( \tan^{-1} \left( \frac{\pi h}{2} \sin (\pi x) \right) \right)\right) \,dx.$$ Because $\tan( \tan^{-1} u) = $u and $\sec (\tan^{-1} u) = \sqrt{1 + u^2}$ for all $u \in \mathbb{R},$ we have \begin{align*} T(h) &= \frac{m}{P} \int_0^1 \frac{\pi h}{2} \sin(\pi x) \,dx + \frac{10}{P} \int_0^1 \sqrt{ 1 + \left( \frac{\pi h}{2} \sin(\pi x)\right)^2} \,dx \\ &= \frac{mh}{P} + \frac{10}{P} \int_0^1 \sqrt{1 + \left( \frac{\pi h}{2} \sin(\pi x)\right)^2} \,dx \\ &= \frac{mh}{P} + \frac{20}{P \pi} E\left(-\frac{\pi^2 h^2}{4}\right),\end{align*} where $E(k) = \int_0^{\pi/2} \sqrt{1 - k \sin^2 t} \,dt$ is the complete elliptical integral of the second kind.

In this case, in particular, if we wanted to see when does $T_c(h) = T_s(h),$ then we have \begin{align*}0 = T_c(h) - T_s(h) &= \left( \frac{m_c h}{P_c} + \frac{20}{P_c \pi} E\left( - \frac{\pi^2 h^2}{4} \right) \right) - \left( \frac{m_s h}{P_s} + \frac{20}{P_s \pi} E \left( - \frac{\pi^2 h^2}{4} \right) \right) \\ &= \frac{1}{P_cP_s} \left( h (P_s m_c - P_c m_s) + \frac{20 (P_s-P_c)}{\pi} E\left( - \frac{\pi^2 h^2}{4} \right) \right),\end{align*} so the two times will be equal when we have $$h \left( \frac{P_c m_s - P_s m_c}{10 (P_s - P_c)} \right) = \frac{2}{\pi} E \left( - \frac{\pi^2 h^2}{4} \right).$$ For our particular climber and sprinter, we know from the Classic problem that $\frac{P_c m_s - P_s m_c}{10 (P_s - P_c)} = 18,$ so we have the implicit equation $$18h = \frac{2}{\pi} E \left(-\frac{\pi^2h^2}{4} \right).$$

To properly root-solve for this implicit equation, we can use a fixed-point iteration method to solve for the point where $f(x) = \frac{1}{9\pi} E(-\frac{\pi^2 x^2}{4} )$ has a fixed point where $f(x)=x.$ In particular, we can define the small Python snippet, using the built-in special function $\textsf{scipy.special.ellipe}$:

Since $\frac{2}{\pi} E(z) \approx 1$ for $z \approx 0,$ let's start with an initial guess of $h_0 = \frac{1}{18}.$ Doing so, quickly retrieves, after 6 iterations the approximate solution of $$h^* \approx 0.05566157787953384\dots,$$ which means that for them to reach the top of the hill at the same time that maximum gradient should be $g_{max} = \frac{\pi h^*}{2} = 8.743300207677981\dots \%.$

No comments:

Post a Comment