From: Trijezni Pijanac on 22 Jan 2007 03:32 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?
From: Nabeel Butt on 23 Jan 2007 04:11 Hi Pijanac, Go to the link : http://mathworld.wolfram.com/PursuitCurve.html It also has a mathematica notebook that can solve your problem. regards, Nabeel On 1/22/07, Trijezni Pijanac <trijezni.pijanac(a)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? > > -- Nabeel Butt LUMS,Lahore
From: Josef Otta on 23 Jan 2007 04:13 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(a)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? > >
From: Murray Eisenberg on 23 Jan 2007 04:18 What's poc0? Why use a dot? Don't you mean a simple multiplication (denoted by * or just juxtaposition with no symbol)? After all, p, q, x, and y presumably are already scalar-valued, not vector-valued. Trijezni Pijanac 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? > -- Murray Eisenberg murray(a)math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2859 (W) 710 North Pleasant Street fax 413 545-1801 Amherst, MA 01003-9305
From: dh on 23 Jan 2007 04:22
Hi Trijezni, you have syntax errors: "." should be "*" and is not necessery. Functions must be written with arguments. See below. Daniel > 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? > |