Re: ORDINARY DIFFERENTIAL EQUATION
- To: mathgroup at smc.vnet.net
- Subject: [mg32175] Re: [mg32170] ORDINARY DIFFERENTIAL EQUATION
- From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
- Date: Fri, 4 Jan 2002 05:03:49 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
A few minutes after posting the answer below I noticed the obvious fact that in your particular case yo do not need even to solve the differential equations to see the flow field. In fact the easiest way to do so is simply load the package: <<Graphics`PlotField` define the function: h[x_,y_]:={(1-x-0.5*y)*x,(1-y-0.8*x)*y} And then plot the flow vector field: PlotVectorField[h[x,y],{x,0,1,0.1},{y,0,1,0.1}] Andrzej Kozlowski Toyama International University JAPAN http://platon.c.u-tokyo.ac.jp/andrzej/ On Wednesday, January 2, 2002, at 09:25 PM, Andrzej Kozlowski wrote: > 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]; > > > 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 >> >> >> >> >