Monday, October 11, 2021

Like two doppelgangers passing in the night, or the Troppel with Doppels

Or perhaps your doppelgänger is now obscured by the lamppost. You start walking along the road, getting closer to the lamppost, but your doppelganger remains hidden. Feeling outmaneuvered, you suspect that your doppelganger moves precisely twice as fast as you at all times. However, unlike you, they are not constrained to a straight road, and can move more freely in two dimensions.

You walk a total of $200$ feet, so that the lamppost is now $100$ feet back and $100$ feet left of the road. Still no sign of the speedy doppelganger, who is assuredly still obscured by the lamppost.

At this point, you contemplate chasing down the doppelganger more directly. But before doing so, you wonder: What is the farthest the doppelganger could be from the lamppost?

Let's assume that my velocity is fixed at $v \gt 0,$ so that my position is given by the point $(vt, 0)$ for $t \in [0,200/v].$ Then in order to be obscured at time $t$, the doppelganger's position $(x(t), y(t))$ must satisfy $$x(t) = vt + \left(1 - \frac{vt}{100}\right) y(t).$$ Therefore, we have $$\dot{x}(t) = v - \frac{y(t)}{100} + \left( 1 - \frac{vt}{100} \right) \dot{y}(t).$$ Since my velocity is $v$, the doppelganger's must be $2v \gt 0,$ or equivalently, \begin{align*} 4v^2 &= \dot{x}(t)^2 + \dot{y}(t)^2 = \left(\left(v - \frac{y(t)}{100}\right) + \left(1 - \frac{vt}{100}\right) \dot{y}(t) \right)^2 + \dot{y}(t)^2 \\ &= \left(1 + \left(1 - \frac{vt}{100}\right)^2 \right) \dot{y}(t)^2 + 2 \left( v - \frac{y(t)}{100} \right) \left( 1 - \frac{vt}{100} \right) \dot{y}(t) + \left( v - \frac{y(t)}{100} \right)^2\end{align*}

Without loss of generality, let's assume that $v = 1.$ Then the nonlinear ODE simplifies to $$ \left(1 + \left(1 - \frac{t}{100}\right)^2 \right) \dot{y}^2 + 2 \left( 1 - \frac{t}{100} \right) \left( 1 - \frac{y}{100} \right) \dot{y} + \left( 1 - \frac{y}{100} \right)^2 - 4 = 0$$ with initial condition $y(0) = 200.$

In theory, since we are after solution which is furthest from the lamppost, we can choose the upper branch of the square root in the quadractic formula solution of the above, that is $$\dot{y} = \frac{-(1 - t/100)(1-y/100) + \sqrt{4 + 4(1- t/100)^2 - (1-y/100)^2}}{1 + (1-t/100)^2}.$$ However, one slight problem with simply using a brute force ODE solver is that there is a numerical instability when $$\Delta(t, y) = 4 + 4 \left(1 - \frac{t}{100}\right)^2 - \left( 1 - \frac{y}{100} \right)^2 \lt 0.$$ However, we can also simplify the problem a bit to avoid this situation, by noting that for any $t > 0,$ if $y(t) = 300,$ then we must have $$\left(1 + \left(1 - \frac{t}{100})^2\right)\right) \dot{y}^2 -4\left(1 - \frac{t}{100}\right) \dot{y} = 0,$$ which has solutions $\dot{y}_1 = 0$ and $\dot{y}_2 = 4(1-t/100)/(1 + (1-t/100)^2).$ Since for $t \gt 100,$ we have $\dot{y}_2 \lt 0$ and we are again interested in the solution with the largest y coordinate value, we should choose $\dot{y} = \dot{y}_1 = 0$ whenever $y = 300.$

So, therefore, we need only integrate the upper branch ODE until we hit the boundary $y(t) = 300$ at some $\hat{t} \gt 0$ and then let $y(t) = 300$ for all $t \in [\hat{t}, 200].$ This leads to the doppelganger ending up at the point $(-100, 300)$ when I reach $(200, 0),$ causing him to be $300 \sqrt{2}$ away from me at that point.

No comments:

Post a Comment