Re: pursuit curve (differential equations)
- To: mathgroup at smc.vnet.net
- Subject: [mg72872] Re: [mg72843] pursuit curve (differential equations)
- From: "Chris Chiasson" <chris at chiasson.name>
- Date: Tue, 23 Jan 2007 05:22:24 -0500 (EST)
- References: <200701220847.DAA17062@smc.vnet.net>
I became interested in your problem because your subject said,
"pursuit curve". Anyway, I don't really understand your code, so here
is my attempt.
Will someone please explain why the fox is so stupid?
rep@params={rabbit->({Cos@#,Sin@#}&),k->2}
(*http://forums.wolfram.com/mathgroup/archive/2003/Aug/msg00224.html*)
vSubtract[args__?VectorQ]=Subtract[args]
deqn=fox'[t]==k*Sqrt[rabbit'[t].rabbit'[t]]*vSubtract[rabbit@t,fox@t]&&fox[0]=={0,1/2}/.rep@params/.(Cos[blah_]^2+Sin[blah_]^2)->1
dsoln=NDSolve[deqn,fox,{t,0,3.5 \[Pi]/2}]
Needs["DifferentialEquations`InterpolatingFunctionAnatomy`"]
ParametricPlot@@{{fox@t,rabbit@t}/.dsoln[[1]]/.rep@params,Flatten@{t,InterpolatingFunctionDomain[fox/.dsoln[[1]]]},AspectRatio->Automatic,PlotStyle->{Red,Black}}
On 1/22/07, Trijezni Pijanac <trijezni.pijanac at gmail.com> wrote:
> hi i am doing pursuit curve in mathematica.. for instance, fox is chasing a
> rabbit - rabbit has a certain defined path (for example - a circle
> {cos(t),sin(t)}. fox always heads directly toward the rabbit.
>
> k - relative speed fox/rabbit
> p,q - rabbit's path (for instance a circle {cos(t),sin(t)}
> x,y - fox's path
> t - time :)
>
> soln = NDSolve[
> {
> x'[t] == k.Sqrt[p'[t]^2 + q'[t]^2].(p - x[t])
> /Sqrt[(p - x[t])^2 + (q - y[t])^2],
> y'[t] == k.Sqrt[p'[t]^2 + q'[t]^2].(y - q[t])
> /Sqrt[(p - x[t])^2 + (q - y[t])^2],
> x[0] == poc0[[1]],
> y[0] == poc0[[2]]
> },
> {x[t], y[t]}, {t, t0, t1}];
>
> but this wont work, any suggestions?
>
>
--
http://chris.chiasson.name/
- References:
- pursuit curve (differential equations)
- From: Trijezni Pijanac <trijezni.pijanac@gmail.com>
- pursuit curve (differential equations)