Mice Problem

Author

Eric W. Weisstein
July 20, 2006

This notebook downloaded from http://mathworld.wolfram.com/notebooks/RecreationalMath/MiceProblem.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/MiceProblem.html.

©2006 Wolfram Research, Inc. except for portions noted otherwise

Code

norm[x_]:=Sqrt[x.x]
Pursuit[l_List,v_:1,{t_,t1_}]:=Module[
{s,a,vars,pairs,n=Length[l],soln,eqns},
vars=Map[#[t]&,Array[a,{n,2}],{2}];
pairs=Partition[vars,2,1,1];
eqns=Join[
Thread[D[Last[#],t]==v (s=Subtract@@#)/norm[s]]&/@pairs,
(Equal@@@Transpose[Flatten/@({Map[#[0]&,Array[a,{n,2}],{2}],l})])
];
soln=NDSolve[Evaluate[eqns],Flatten[vars],{t,0,t1}];
Partition[Map[Last,soln,{2}][[1]],2]
]

Vertices[n_]:=Through[{Cos,Sin}[2π #/n]]&/@Range[0,n-1]
ClosedLine[l_List]:=Line[Append[l,First[l]]]

MiceProblem[n_,{t_,t1_},v_:1]:=Pursuit[Vertices[n],v,{t,t1}]

Derivation

Solve the pursuit curve equations for P'(t)

(({ax,ay}-{bx,by})/(norm[{ax,ay}-{bx,by}])).(({dpx,dpy})/v)==1

Solve[{(({ax,ay}-{bx,by})/(norm[{ax,ay}-{bx,by}])).(({dpx,dpy})/v)==1,dpx^2+dpy^2==v^2},{dpx,dpy}]//FullSimplify

Thread[D[Last[#],t]==v (s=Subtract@@#)/norm[s]]&/@{{{ax[t],ay[t]},{bx[t],by[t]}}}

Solve the pursuite equations

Graphics

With[{n=3},
ParametricPlot[Evaluate[MiceProblem[n,{t,2}]],{t,0,1.154},PlotStyle->{{Thickness[.02],Red}},
AspectRatio->Automatic,Ticks->None,
Epilog->ClosedLine[Vertices[n]]]
]

With[{n=4},
ParametricPlot[Evaluate[MiceProblem[n,{t,2}]],{t,0,1.414},PlotStyle->{{Thickness[.02],Red}},
AspectRatio->Automatic,Ticks->None,
Epilog->ClosedLine[Vertices[n]]]
]

With[{n=5},
ParametricPlot[Evaluate[MiceProblem[n,{t,2}]],{t,0,1.701},PlotStyle->{{Thickness[.02],Red}},
AspectRatio->Automatic,Ticks->None,
Epilog->ClosedLine[Vertices[n]]]
]

Show[GraphicsArray[Table[
			Show[MouseProblem[n,Floor[100 n/6]],AspectRatio->Automatic,
PlotRange->All,DisplayFunction->Identity],{n,3,6}]]]

Animations

Export[gifs<>"mice3.gif",
Table[Show[MouseProblem[3,i,.05,Mice->True],AspectRatio->Automatic,PlotRange->All],{i,30}],
"GIF",ImageSize->150,AnimationDirection->ForwardBackward]

Export[gifs<>"mice4.gif",
Table[Show[MouseProblem[4,i,.07,Mice->True],AspectRatio->Automatic,PlotRange->All],{i,40}],
"GIF",ImageSize->150,AnimationDirection->ForwardBackward]

Export[gifs<>"mice5.gif",
Table[Show[MouseProblem[5,i,.1,Mice->True],AspectRatio->Automatic,PlotRange->All],{i,30}],
"GIF",ImageSize->150,AnimationDirection->ForwardBackward]

Export[gifs<>"mice6.gif",
Table[Show[MouseProblem[6,i,.1,Mice->True],AspectRatio->Automatic,PlotRange->All],{i,30}],
"GIF",ImageSize->150,AnimationDirection->ForwardBackward]