4
$\begingroup$

This question stems from an old 538 puzzle involving a duck in a pond and a fox patrolling the edge of the pond.

I was able to setup a system of ODEs that probably do not have an explicit solution:

pd = {rd[t] Cos[thetad[t]], rd[t] Sin[thetad[t]]}
pf = {r Cos[thetaf[t]], r Sin[thetaf[t]]}
thetadir = FullSimplify[ArcCos[pd.(pf - pd)/(Norm[pd]*Norm[pf - pd])]]

DSolve[{
   rd'[t] == vd*Sin[thetadir],
   thetad'[t] == vd/rd[t]*Cos[thetadir],
   thetaf'[t] == vf/r,
   rd[0] == 10^-5,
   thetad[0] == Pi,
   thetaf[0] == 0
 },
 {rd, thetad, thetaf}, t,
 Assumptions -> {
   t ∈ Reals, t >= 0, 
   r ∈ Reals, r > 1,
   vd ∈ Reals, vd > 0,
   vf ∈ Reals, vf > vd,
   rd[t] ∈ Reals,
   thetaf[t] ∈ Reals,
   thetad[t] ∈ Reals
 }
]

The desire is that I find vf/vd in terms of $r$ such that rd == r when thetad == thetaf. This will give the upper bound of the speed of a fox that a duck can escape.

The behavior of $rd$ is monotonic and unbounded when $vf/vd$ is less than this value. And it contains a local maximum when $vf/vd$ is greater than this value. (When it is equal to this value, then we get a divide by zero because Norm[pf - pd] == 0).

I can use NDSolve if I give initial values for vd, vf, and r, however, I don't know how to iterate through values of vd, vf, and r to where I can "zero in" on this critical point and find the relationship between these three values. Can I get some insight?

$\endgroup$
5
  • 2
    $\begingroup$ You might benefit from ParametricNDSolve. $\endgroup$
    – evanb
    Commented Feb 21, 2017 at 16:41
  • $\begingroup$ Can't you write explicitely the criticality conditions, by solving the system of "derivatives == 0", for the unknowns vd, vf, and r? $\endgroup$
    – anderstood
    Commented Feb 21, 2017 at 18:37
  • $\begingroup$ note since thetaf'[t] is constant you can remove that from the system of equations and simply use thetaf=vf/r t $\endgroup$
    – george2079
    Commented Feb 22, 2017 at 1:01
  • $\begingroup$ FWIW the puzzle has a trivial (lower bound) solution that the duck can beat the fox if vf/vd < 1 + Pi. The actual solution is something more than that.. $\endgroup$
    – george2079
    Commented Feb 22, 2017 at 15:37
  • $\begingroup$ Yeah, I found the correct solution. I was just chasing this idea to see what I got. $\endgroup$ Commented Feb 22, 2017 at 16:25

1 Answer 1

3
$\begingroup$

Normalizing by setting r = 1 and vd (the speed of the duck) to 1, and then using ParametricNDSolve, provides functions in vf (speed of the fox) and t for rDuck, thetaDuck, and thetaFox. Findroot solves for rDuck = 1 (where the fox is) and thetaDuck = thetaFox.

The fox travels at a speed of 2.34 to meet the duck in 1.2, in whatever units are in use.

pd={rd[t] Cos[thetad[t]],rd[t] Sin[thetad[t]]} ;
pf={r Cos[thetaf[t]],r Sin[thetaf[t]]};
 thetadir=FullSimplify[ArcCos[pd.(pf-pd)/(Norm[pd]*Norm[pf-pd])]];
normalization={r->1,vd->1};
{frd,fthetaf,fthetad}={rd,thetad,thetaf}/.ParametricNDSolve[{rd'[t]==vd*Sin[thetadir],thetad'[t]==vd*Cos[thetadir],thetaf'[t]==vf/r,rd[0]==10^-5,thetad[0]==Pi,thetaf[0]==0}/.normalization,{rd,thetad,thetaf},{t,0,100},{{vf,.5,5}}];
sol2=FindRoot[{frd[vf][t]==1,fthetad[vf][t]==fthetaf[vf][t]},{{vf,2},{t,50}}]
(* {vf\[Rule]2.3448618677572135`,t\[Rule]1.2171083713163402`} *)
Plot[{frd[vf][tt],fthetad[vf][tt],1,fthetaf[vf][tt]}
/.sol2//Evaluate,Evaluate[{tt,0,t}/.sol2],PlotLegends->{"Rduck","ThetaDuck","Rfox","ThetaFox"}]

enter image description here

I do find it a bit puzzling that the fox seems to reverse course!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.