6

This is probably not well known problem but it looks like open problem. What kind of methods there are to find a closed form solution to the physical situation?


Can you solve this problem?

You're passively flowing downstream in the middle of a river that has its fastest flow in the middle. Most places along the riverbank are too steep or too vegetated, but suddenly you spot a perfect location for coming ashore a distance y away (measured along the river bank).

Note that y can be zero so that you only spot it when you're already drifting past it; or if you're slower still, y can be negative.

Now assume your swimming speed is a constant v, while the river's flow is V in the middle and linearly decreasing towards the shore. What angle should you take, as a function of your distance to the shore (x), to reach the desired location using minimum effort (i.e. shortest journey or, equivalently, shortest time)?

enter image description here

Source and image credit: Hanna Kokko.

Qmechanic
  • 220,844
curious
  • 99

4 Answers4

4

You have essentially calculated all that's necessary. I'll just give the finishing touches here.

The variational problem is that of minimizing $$T(\theta)+\lambda(C(\theta)-y).$$ Since neither integral depends on $\theta'(x)$, the minimization problem is quite simple, and you simply set the derivative of the integrand to zero: $$\delta\int_0^L \frac{1+\lambda(v_0\sin \theta (x)+v(x))}{v_0\cos \theta(x)} \text dx=0 $$ implies $$ \frac{d}{d\theta}\left[\frac{1+\lambda(v_0\sin \theta (x)+v(x))}{v_0\cos \theta(x)}\right]=0, $$ and this quite trivially leads to $\sin \theta (x)=\frac{\lambda v_0}{v_0+\lambda v(x)}.$

The minimization over $\lambda$ simply leaves the equation at $C(\theta)-y=0$, so as usual all you need for the minimum over the multiplier to be satisfied is for the constraint to be obeyed. Substituting in your expression for $\theta(x)$ and the linear decrease in $v(x)=(\frac xL-1)u$ you get that the constraint, which is now a function of $\lambda$ (!) is now $$ \begin{array}{} C(\lambda)\!\!&=\int_0^L \frac{v_0\frac{\lambda v_0}{v_0+\lambda v(x)}+v(x)}{v_0\sqrt{1-\left(\frac{\lambda v_0}{v_0+\lambda v(x)}\right)^2}} \text dx =\int_0^L \frac{\lambda v_0^2+v(x)(v_0+\lambda v(x))} {v_0\sqrt{\left({v_0+\lambda v(x)}\right)^2-\lambda^2 v_0^2}} \text dx \\ & =\int_0^L \frac{\lambda v_0^2+(\frac xL-1)u(v_0+\lambda (\frac xL-1)u)} {v_0\sqrt{\left({v_0+\lambda (\frac xL-1)u}\right)^2-\lambda^2 v_0^2}} \text dx. \end{array} $$ This is a fairly complicated integral and I have not the faintest idea of how to do it analytically. However, Wolfram Alpha can calculate the indefinite integral. (Thus, if you're feeling nitpicky, you can go and differentiate that result and check that it reproduces the integrand, and then substitute in the limits to get the definite integral. In the process you might also learn how you could calculate it directly, too!) Me, I just put it into Mathematica and I got back some horrible expression: $$ C(\lambda)= \frac{L}{2 \lambda ^2 u \text{v0}} \left[ -3 \lambda ^2 {v_0}^2 \log \left(-\lambda u +\sqrt{(\lambda u-\lambda {v_0}-1) (\lambda (u+{v_0})-1)}+1\right)+(\lambda u+1) \sqrt{(\lambda u-\lambda {v_0}-1) (\lambda (u+{v_0})-1)}-\sqrt{1-\lambda ^2 {v_0}^2}+3 \lambda ^2 {v_0}^2 \log \left(\sqrt{1-\lambda ^2 {v_0}^2}+1\right) \right]. $$

This is very ugly and it is very late here so I have no intention of peering into the details of this function. However, you can begin to make some sense of it by noticing that the presence of the logarithms and square roots require that

  • $\lambda^2 v_0^2\leq 1$ for the small square root to be real,
  • $(u^2-v_0^2)\lambda^2-2u\lambda+1\geq 0$ for the bigger square root to make sense, and
  • $1-\lambda u+\sqrt{(u^2-v_0^2)\lambda^2-2u\lambda+1}\geq 0$ for the logarithm to be defined.

Playing around with this condition you can prove that all three hold if and only if $$-\frac 1{v_0}<\lambda<\frac1{u+v_0},$$ or possibly with $\leq$ signs instead.

There are two distinct regimes of behaviour for this function, each with quite distinct physical meaning: $u<v_0$ and $u>v_0$.

  • If $v_0<u$, then you have a limited downstream range available. To find out where you can get to and how you can get there, you need to solve the equation $C(\lambda)=y$ to find $\lambda$. This will determine $\theta(x)$ and therefore the travel time $T$. Inverting $C$ is not easy: Mathematica refuses to do it and I won't try. Numerically it's easy, and here's a nice graph for it (with $L$ set to 1):

enter image description here

You simply take some $y$, find $\lambda$ that will give you $C(\lambda)=y$ and find $T(\lambda) $ there. (Of course, you also need to calculate $T(\lambda)$, which is the same deal as $C$. Mathematica says this is $$ T(\lambda) =\frac{\sqrt{1-\lambda ^2 v_0^2}-\sqrt{(\lambda u-\lambda v_0-1) (\lambda (u+v_0)-1)}}{\lambda u v_0},$$ modulo units, and I blindly believe it.

Although I would like to think the ends of the curves go down to $-\infty$, they apparently have finite limits there - I don't really know what to make of that.

  • If $v_0>u$, then I would think you can beat the current and you can get to any $y$ you want, although travelling upstream you might end up spending a bit of time fighting the current. The corresponding plot is

enter image description here

and again both limits are finite. Thus it would appear you can't reach all $y$'s - and I'll leave this thing here: there's plenty of mouse tails for you to chase now!

Oh, and do tell Hanna Kokko about this Q&A...

Emilio Pisanty
  • 137,480
3

This is not a complete solution but too long comment.

Let as assume that the river width is $L$ and that the swimmer goes all the time at least a little towards the riverbank, so that $x(t)$ is strictly increasing. Therefore, it has an inverse $t(x)$. Now we find that $$\int_0^T dt=\int_0^L\frac{dt}{dx}dx=\int_0^L\frac{dx}{v_0\cos \theta(x)}.$$ Now we have $ y=\int_0^L\frac{v_0\sin \theta (x)+v(x)}{v_0\cos \theta (x)}dx$. So we have to minimize the functional $$T(\theta )=\int_0^L\frac{dx}{v_0\cos \theta(x)}$$ in the set $ W=\{\theta \in C^1 [0,L]|C(\theta)=y\}$, where $$ C(\theta)=\int_0^L\frac{v_0\sin \theta (x)+v(x)}{v_0\cos \theta (x)}dx. $$

The next step would be to use Lagrange multipliers to $\sin \theta (x)=\frac{\lambda v_0}{v_0+\lambda v(x)}.$

The functional is now $$ C(\theta)=\int_0^L\frac{v_0\frac{\lambda v_0}{v_0+\lambda v(x)}+v(x)}{\pm v_0\sqrt{1-(\frac{\lambda v_0}{v_0+\lambda v(x)}})^2}dx. $$

but the expression seems to be hard to be minimized analytically or to prove that there is no solution.

Am I on the right track?

curious
  • 99
3

The solution by inspection

The path which takes the least time to travel is one which corresponds to a straight line in the Lagrangian coordinates of the flow.

For this particular velocity profile lines that are straight in the Eulerian coordinates are also straight in the Lagrangian coordinates.

In other words, if you draw a straight line between the point in the flow which you start at (moving at velocity $v$) and the point on the bank which you are aiming for, no flow crosses this line, and I believe swimming along this line is the shortest path.

Thus your angle is given by $tan \theta = \frac{Y-v_0 t}{X}$.


An analytical form for the path

To find an exact form for this path first take $s$ as a parameterisation of the point in the flow corresponding to the start, and the point on the bank you are aiming for. On this line $s=0$ corresponds to $(0,0)$, the comoving start point, and $s=X$ corresponds to the target point at $(X,Y)$. We find for a flow of the form

$v=v(x)=v_0(1-\frac{x}{X})$

such a line is given by

$\mathbf{r}(s)=s \,\mathbf{\hat{x}} + (\frac{s Y}{X}+v(s)t))\mathbf{\hat{y}}$

that the distance from $s$ to $s+ds$ is

$dl=\sqrt{(\frac{d \mathbf{r}}{d s})^2}ds=\sqrt{1+(\frac{Y-v_0 t}{X})^2}ds$

using that $\frac{dl}{dt}=u$ is the speed of the swimmer, thus

$\frac{ds}{dt}=\frac{u X}{\sqrt{(X^2+(Y-v_0 t)^2}}$

which can be integrated to yield

$s(t)=\int_0^t \frac{u X dt}{\sqrt{X^2+(Y-v_0 t)^2}}$

$Y+t v_0 = Y \cosh{(\frac{s v_0}{u x})}+ \sqrt{Y^2+X^2}\sinh{(\frac{s v_0}{u x})}$

since the path $\mathbf{r}$ we are travelling along is given in Eulerian $(x,y)$ coordinates as

$\mathbf{r}(s)=s \,\mathbf{\hat{x}} + \frac{Ys+v_0 t(X-s)}{X}\mathbf{\hat{y}}$

we find by substituting for the curve can be defined in terms of $s$ alone.

Below is a plot of a family of solutions for $X=1, v_0=-1, u=1$ with $-1 \leq Y \leq 1$

Plots of the swimmers path for varying target position

And additionally a plot of solutions for $X=1, Y=1, u=1$ with $0 \geq v_0 \geq -5$

Plots of the swimmers path for varying flow speed


The solution always exists

Note also that there is always a solution. To see this consider the swimmer who travels perpendicularly to the flow he will reach the bank in finite time. Then he is in a region of zero flow speed and so can reach any point on the bank in finite time.


A justification from calculus of variations

The principle challenge of this problem comes from the poor choice of coordinates. In stead of using the coordinates

$\mathbf{r}(x,y) = x \mathbf{\hat{x}} + y \mathbf{\hat{y}}$

I recommend the use of the comoving coordinates

$\mathbf{r}(s,\tau) = s \mathbf{\hat{x}} + v(s)(t-\tau) \mathbf{\hat{y}}$

By identifying the coordinate singularity at $s=X$ with the point $(X,Y)$ on the bank in the original problem we see this feature will not cause problems. The coordinates are comoving and a fluid parcel at $(s_1,\tau_1)$ remains at this coordinate for all time and passes level to the origin and coordinate singularity at a time $t=\tau_1$

In these coordinates a line segment is given by

$dl^2=ds^2+(v'(s)(t-\tau)ds-vd\tau)^2$

By identifying the speed $\frac{dl}{dt}$ with the swimmers speed $u$, we obtain

$\frac{ds}{dt}=\frac{v}{\sqrt{1+(v'(s)(t-\tau)-v \tau'(s))^2}}$

thus

$t=\int_0^t dt' = \int_0^X \frac{dt}{ds}ds = \frac{1}{u} \int_0^X \sqrt{1+(v'(s)(t-\tau)-v \tau'(s))^2} ds$

varying this with respect to the unknown function $\tau(s)$ gives the E-L equation

$2 v'(s) \tau'(s) - (t-\tau(s))v''(s)+v(s)\tau''(s)=0$

or alternatively

$\frac{d^2}{ds^2}(v(s) (t-\tau(s)))=0$

with the obvious solution

$v(s)(t-\tau)=-c_1 s + c_0$

by imposing the condition that both sides go to zero for $s=0$ we have

$v(s)(t-\tau)=c_1(X-s)$

thus by noticing the dependence on the RHS is the same as $v(s)$, all we are left with is consants. Thus by differentiating we obtain

$\frac{\partial \tau}{\partial s} = 0$

Therefore we conclude that the shortest path to swim follows the comoving coordinates of the flow.

ComptonScattering
  • 1,124
  • 7
  • 11
1

This answer will rely on the same method as the two answers of users curious and Emilio Pisanty, possibly dotting a few i's along the way. In particular, we will pay attention to signs, which play an important role (e.g. Should the swimmer swim upsteam$^1$ or downstream?).

I) In this answer we consider the time-reversed (but equivalent) problem of minimizing the total time $T$ it takes to go from the river shore $(x_i,y_i)=(0,0)$ to a fixed position $(x_f,y_f)=(L,y_f)$ in the middle of the river (in a coordinate system that is stationary wrt. the shore). In other words, we use Eulerian (as opposed to Lagrangian) coordinates. Let the velocity profile of the river be linear

$$v(x)~:=~ \frac{x}{L}V.\tag{1}$$

The velocity of the swimmer is

$$\begin{align}\dot{x}~=~&v_0 \cos\theta > 0,\cr \dot{y}~=~& v_0 \sin\theta + v(x),\end{align}\tag{2}$$

where the angle $\theta\in ]-\frac{\pi}{2},\frac{\pi}{2}[$ is a control parameter. (We assume that bang-bang solutions $|\theta|=\frac{\pi}{2}$ are not relevant.)

II) Let us for convenience go to dimensionless primed coordinates

$$\begin{align} x ~=~& L x^{\prime}, \cr y ~=~& L y^{\prime},\cr t ~=~& \frac{L}{v_0} t^{\prime},\cr V ~=~& v_0 V^{\prime}.\end{align}\tag{3}$$

We will not write the primes explicitly from now on. This has the effect of scaling the parameters

$$ L~=~1~=~v_0.\tag{4}$$

(The dimensionful parameters $L$ and $v_0$ can easily be recovered in the end by dimensional analysis.)

III) Noticing the positive $x$-velocity (2), we next reparametrize the problem in terms of $x$ rather than $t$, i.e. $x$ will play the role of a 'clock' for the swimmer. This has the added benefit that the final 'time' $x_f=L=1$ is fixed (as opposed to free), which makes the optimal control problem simpler. We also pick a new control parameter

$$ s(x)~:=~\sin\theta(x)~ \in~ ]-1,1[.\tag{5}$$

IV) The total time becomes

$$\begin{align} T~=~&\int_0^T \!dt\cr ~=~& \int_0^1 \! \frac{dx}{\dot{x}} \cr ~=~& \int_0^1 \! \frac{dx}{\sqrt{1-s^2}}.\end{align} \tag{6}$$

The $y$-coordinate is (with the slight abuse of notation where the upper integration limit $x$ and integration variable $x$ are given the same name)

$$\begin{align} y(x)~=~&\int_0^{y(x)} \!dy\cr ~=~& \int_0^x \!dx \frac{dy}{dx} \cr ~=~& \int_0^x \!dx \frac{\dot{y}}{\dot{x}} \cr ~=~& \int_0^x \!dx \frac{s+v}{\sqrt{1-s^2}}. \end{align}\tag{7}$$

The final $y$-coordinate is similarly

$$ y_f~=~\int_0^1 \! dx\frac{s+v}{\sqrt{1-s^2}}. \tag{8}$$

V) The task is to minimize (6) keeping in mind the constraint (8). The 'action' becomes

$$ \begin{align}S ~=~& T +\lambda\left(y_f-y(x\!=\!L)\right) \cr ~=~&\int_0^1 \!dx~ L,\end{align}\tag{9} $$

with Lagrangian

$$\begin{align} L ~=~&\frac{1}{\sqrt{1-s^2}} + \lambda \left[\frac{s+v}{\sqrt{1-s^2}} -y_f\right]\cr ~=~& \frac{1+\lambda(s+v)}{\sqrt{1-s^2}}-\lambda y_f. \end{align}\tag{10}$$

Here $\lambda$ is an $x$-independent Lagrange multiplier. The Euler-Lagrange equation reads

$$ \begin{align} 0 ~\approx~&\frac{\partial L}{\partial s} ~=~ \frac{s(1+\lambda v)+\lambda}{(1-s^2)^{\frac{3}{2}}} \cr \Updownarrow & \cr s~\approx~& -1/w,\end{align}\tag{11}$$

where we have defined

$$\begin{align} w(x)~:=~&v(x)+\mu, \cr \mu~:=~&\frac{1}{\lambda}.\end{align}\tag{12} $$

The $\approx$ symbol in eq. (11) means equality modulo equation of motion.

VI) We see from the eom (11), that the optimal strategy for the cosecant $\csc\theta(x)\approx-w(x)$ is an affine (and therefore monotonic) function of $x$. E.g. it is not optimal to first swim upstream and later downstream. Moreover, swimming straight into the river $s=0$ will never be an optimal strategy (apart from the trivial case $V=0=y_f$). Let us therefore exclude $s=0$ in what follows. Hence the control double inequality (5) is divided into swimming downstream or swimming upstream$^1$,

$$ 0~<~s~<~1 \quad \vee \quad -1~<~s~<~0, \tag{13}$$

or equivalently,

$$ w ~< ~ -1 \quad \vee \quad w~>~1,\tag{14} $$

or equivalently,

$$ \mu ~<~ -(V+1) \quad \vee \quad \mu ~>~1, \tag{15} $$

or equivalently,

$$ -\frac{1}{V+1} ~<~ \lambda~<~0\quad \vee \quad 0~<~\lambda ~<~1,\tag{16}$$

respectively. In particular, we conclude that the control parameter $s$ and the Lagrange multiplier $\lambda$ have opposite signs,

$$ -{\rm sgn}(s)~=~{\rm sgn}(w)~=~{\rm sgn}(\mu)~=~{\rm sgn}(\lambda).\tag{17}$$

VII) The minimal total time becomes

$$\begin{align} T ~\stackrel{(6)+(11)}{\approx}& \int_{x=0}^{x=1} \!\frac{dw}{V} \frac{|w|}{\sqrt{w^2-1}}\cr ~=~& \frac{1}{V} \left[{\rm sgn}(w) \sqrt{w^2-1}\right]_{x=0}^{x=1}\cr ~=~& \frac{{\rm sgn}(\mu)}{V} \left(\sqrt{(V+\mu)^2-1}-\sqrt{\mu^2-1}\right) \end{align}\tag{18}. $$

The optimal $y$-coordinate is

$$\begin{align} y(x)~\stackrel{(8)+(11)}{\approx}& \int_{x=0}^{x=x} \! \frac{dw}{V}\frac{v|w|-{\rm sgn}(w)}{\sqrt{w^2-1}} \cr ~=~& \int_{x=0}^{x=x} \! \frac{dw}{V}{\rm sgn}(w)\frac{(w-\mu)w-1}{\sqrt{w^2-1}} \cr ~=~& \int_{x=0}^{x=x} \! \frac{dw}{V}{\rm sgn}(w) \sqrt{w^2-1} - \mu T \cr ~=~& \frac{1}{2V} \left[|w| \sqrt{w^2-1} -{\rm sgn}(w) {\rm arcosh}(w)\right]_{x=0}^{x=x} - \mu T \cr ~=~& \frac{1}{2V} \left[{\rm sgn}(w)\left( (w-2\mu) \sqrt{w^2-1}- {\rm arcosh}(w)\right)\right]_{x=0}^{x=x} \cr ~=~&\frac{{\rm sgn}(\mu)}{2V} [ (v(x)-\mu) \sqrt{(v(x)+\mu)^2-1}+\mu\sqrt{\mu^2-1} \cr & -{\rm arcosh}(v(x)+\mu)+{\rm arcosh}(\mu)]. \end{align}\tag{19}$$

The optimal final $y$-coordinate is similarly

$$\begin{align} y_f ~=~&\frac{{\rm sgn}(\mu)}{2V} [ (V-\mu) \sqrt{(V+\mu)^2-1}+\mu\sqrt{\mu^2-1} \cr & -{\rm arcosh}(V+\mu)+{\rm arcosh}(\mu)]. \end{align}\tag{20}$$

Eq. (20) is an equation for the (reciprocal) Lagrange multiplier $\mu$ in terms of $y_f$ and $V$. The solution for $\mu$ should then be inserted in the formula (18) for $T$ to get the sought-for final result. However in general there is no hope to solve the transcendental eq. (20) in closed form. But one may find explicit solutions in certain limits. For instance in the weak current limit $V\ll 1$.

VIII) Let us finally study the weak current limit $V\ll 1$. In that limit the minimal total time is

$$\begin{align}0~<~T~\simeq~& {\rm sgn}(\mu)\left[ \frac{\mu}{\sqrt{\mu^2-1}} -\frac{1}{2(\mu^2-1)^{\frac{3}{2}}}V +\frac{\mu}{2(\mu^2-1)^{\frac{5}{2}}}V^2 +{\cal O}(V^3)\right]\cr ~\stackrel{(23)}{\simeq}~& -\mu z +\frac{z^3}{2}V+{\cal O}(V^2) ,\end{align}\tag{21}$$

and the optimal final $y$-coordinate is

$$\begin{align} y_f~\simeq~& {\rm sgn}(\mu)\left[ -\frac{1}{\sqrt{\mu^2-1}} +\frac{\mu^3}{2(\mu^2-1)^{\frac{3}{2}}}V +\frac{1-4\mu^2}{6(\mu^2-1)^{\frac{5}{2}}}V^2 +{\cal O}(V^3) \right] \cr ~\stackrel{(23)}{\simeq}~& z +\frac{(-\mu z)^3}{2}V+{\cal O}(V^2)\cr ~\stackrel{(21)}{\simeq}~& z +\frac{T^3}{2}V+{\cal O}(V^2) .\end{align}\tag{22}$$

Here we have introduced a convenient expansion parameter

$$\begin{align} z~:=~ -\frac{{\rm sgn}(\mu)}{\sqrt{\mu^2-1}}, \qquad {\rm sgn}(z)~=~-{\rm sgn}(\mu). \tag{23} \end{align} $$

Eq. (22) may be inverted

$$ z ~\simeq~y_f-\frac{T^3}{2}V+{\cal O}(V^2) , \tag{24}$$

$$ |\mu|~\simeq~ \sqrt{1+y_f^{-2}} -{\rm sgn}(\mu) \frac{1+y_f^{-2}}{2}V +{\cal O}(V^2) . \tag{25}$$

Thus we arrive at a weak limit formula for the minimal time

$$ T~\simeq~ \sqrt{y_f^2+1} - {\rm sgn}(\mu)\frac{|y_f|^3}{2}V+{\cal O}(V^2). \tag{26} $$

The sign ${\rm sgn}(\mu)=-{\rm sgn}(z)$ should be determined from eq. (24).

As a quick check we see that eq. (26) reproduces Pythagoras' formula $(v_0T)^2\simeq y_f^2+L^2$ when there is no current $V=0$ at all.

From eqs. (22) or (24) we deduce that $z< y_f$. On one hand, if $y_f<0$ is upstream, then $z>0$ and $\mu<0$, meaning that the swimmer should not surprisingly swim upstream. On the other hand, if $y_f>0$ is downstream, for the swimmer to determine whether he should swim up- or downstream$^1$, he must first determine the sign of $z$ from eq. (24).

--

$^1$ Here we mean swimming upstream in the steering sense. The resulting motion may be downstream due to the river flow.

Qmechanic
  • 220,844