Re: ORDINARY DIFFERENTIAL EQUATION
- To: mathgroup at smc.vnet.net
- Subject: [mg32174] Re: [mg32170] ORDINARY DIFFERENTIAL EQUATION
- From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
- Date: Fri, 4 Jan 2002 05:03:48 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
You should specify the region over which you wish to plot the flow
lines, which means both the "starting points" and the duration of flows.
Since you do not I shall choose it myself.
In[1]:=
g[a_, b_] := Module[{x, y, t},
{x, y} /. Flatten[NDSolve[{Derivative[1][x][t] == (1 - x[t] -
0.5*y[t])*x[t],
Derivative[1][y][t] == (1 - y[t] - 0.8*x[t])*y[t], x[0] == a,
y[0] == b}, {x, y},
{t, 0, 10}]]]
In[2]:=
pl[x_, y_] := ParametricPlot[Evaluate[Through[g[x, y][t]]], {t, 0, 10},
DisplayFunction -> Identity]
In[3]:=
flowLines = Table[pl[x, y], {x, 0, 1, 0.1}, {y, 0, 1, 0.1}];
In[4]:=
Show[flowLines, DisplayFunction -> $DisplayFunction];
You might also wish to see some arrows to make the directions of the
flows more clear. Too many arrows tend to make a picture messy (unless
one takes a lot of care to get their proportions right, for which I do
not have time), so here are just a few:
In[5]:=
<< "Graphics`Arrow`"
In[6]:=
vectors[x_, y_] := Graphics[Table[Arrow[Through[g[x, y][t]],
Through[g[x, y][t]] +
(D[Through[g[x, y][s]], s] /. s -> t)/3], {t, 0, 10}]]
In[7]:=
vectorField = Table[vectors[x, y], {x, 0, 1, 0.2}, {y, 0, 1, 0.2}];
In[8]:=
Show[vectorField, DisplayFunction -> $DisplayFunction];
Andrzej Kozlowski
Toyama International University
JAPAN
http://platon.c.u-tokyo.ac.jp/andrzej/
On Wednesday, January 2, 2002, at 05:28 PM, Khaled Saad wrote:
> Dear mathgroup
> I am trayin to plot the directin of vector field of system of ordinary
> differential equation but i could not
>
> the system is
> x'[t]=(1-x[t]-0.5 y[t])x[t]
> y'[t]=(1-y[t]-0.8 x[t])y[t]
>
> With best regards
> Khaled
>
> _________________________________________________________________
> Chat with friends online, try MSN Messenger: http://messenger.msn.com
>
>
>
>