Re: pursuit curve (differential equations)
- To: mathgroup at smc.vnet.net
- Subject: [mg72858] Re: [mg72843] pursuit curve (differential equations)
- From: "Josef Otta" <josef.otta at gmail.com>
- Date: Tue, 23 Jan 2007 04:23:04 -0500 (EST)
Hi,
i think that you have some missing arguments in your equation. I tried to
repair it (q->q[t], p->p[t] etc.)and here is the output:
p[t_] := Sin[t];
q[t_] := Cos[t];
k = 10.;
t0 = 0;
t1 = 6Pi;
poc0 = {1, 2};
soln = {x[t],
y[t]} /. NDSolve[{x'[t] == k*
Sqrt[p'[t]^2 + q'[
t]^2]*(p[t] - x[t])/
Sqrt[(p[t] - x[t])^2 + (q[t] - y[t])^2], y'[t] == k*
Sqrt[p'[t]^2 + q'[t]^2]*(y[t] - q[t])/
Sqrt[(p[t] - x[t])^2 + (q[t] - y[
t])^2], x[t0] == poc0[[1]], y[t0] ==
poc0[[2]]}, {x[t], y[t]}, {t, t0, t1}][[1]]
Regards,
Josef Otta
http://home.zcu.cz/~jotta
2007/1/22, Trijezni Pijanac <trijezni.pijanac at gmail.com>:
>
> 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?
>
>