advancedphaseplot.mw

> with(DEtools):with(plots):with(plottools):

Warning, the name changecoords has been redefined

We make a detailed study of the nonlinear system of differential equations,

x' = 2x + y^2

y' = x + y + xy

The critical points can be found with fsolve

> fsolve({2*x+y^2=0,x+y+x*y=0},{x,y},{x=-5..5,y=-5..5});

{x = -2.000000000, y = -2.000000000}

It missed two of them! The other two are (0,0) and (-1/2,1).

> pp:=phaseportrait([D(x)(t)=2*x(t)+y(t)^2,
D(y)(t)=x(t)+y(t)+x(t)*y(t)],

[x(t),y(t)],t=-2..1,

[[x(0)=0,y(0)=2],[x(0)=-1,y(0)=-1],[x(0)=1,y(0)=1],[x(0)=0,y(0)=-2],[x(0)=-2,y(0)=0],[x(0)=-4,y(0)=-4]],

x=-5..5,y=-5..5,color=blue,linecolor=black):

> ypz:=plot(-x/(1+x),x=-5..5,y=-5..5,discont=true, thickness=3):

> xpz:=plot({sqrt(-2*x), -sqrt(-2*x)}, x=-5..0,y=-5..5,color=green, thickness=3):

> display(pp,ypz,xpz);

[Plot]

Next we zoom out. At first I thought is was a saddle (I did not plot any sution curves the time I did it). But, that's no saddle.

> phaseportrait([D(x)(t)=2*x(t)+y(t)^2,
D(y)(t)=x(t)+y(t)+x(t)*y(t)],

[x(t),y(t)],t=-1..0.8,

[[x(0)=0,y(0)=25],[x(0)=-25,y(0)=-25],[x(0)=10,y(0)=10],[x(0)=0,y(0)=-20],[x(0)=-15,y(0)=-4],[x(0)=-15,y(0)=0],[x(0)=30,y(0)=-20],[x(0)=30,y(0)=20]],

x=-50..50,y=-50..50,color=blue,linecolor=black,stepsize=.01);

[Plot]

The down side of direction fields and phase portraits is that you do not see how fast thing are moving. Below I compute the magnitude of the velocity vector at each point and use this to make a color density plot. The orange area are low speeds zones; the purple areas are high speed zones.

> denp:=densityplot(sqrt((2*x+y^2)^2 + (x+y+x*y)^2),x=-5..5,y=-5..5,colorstyle=HUE,grid=[50,50],style=PATCHNOGRID):

> saddle1 := point([-2,-2], color=black,symbol=cross):

> saddle2 := point([-1/2,1], 1, color=black,symbol=cross):

> repeller:= point([0,0], 1, color=black,symbol=circle):

> display(denp,saddle1,saddle2,repeller);

[Plot]

Let's investigate the flow between the origin and the (-1/2,1) saddle.

> pp:=phaseportrait([D(x)(t)=2*x(t)+y(t)^2,
D(y)(t)=x(t)+y(t)+x(t)*y(t)],

[x(t),y(t)],t=-7..0,

[[x(0)=-0.48,y(0)=0.97],[x(0)=-0.51,y(0)=1.02]],

x=-1..0,y=0..1.5,color=blue,linecolor=black):

ypz:=plot(-x/(1+x),x=-1..0,y=0..1.5,discont=true, thickness=3):

xpz:=plot({sqrt(-2*x), -sqrt(-2*x)}, x=-1..0,y=0..1.5,color=green, thickness=3):

display(pp,ypz,xpz);


[Plot]

I'm really curious if there is a nice equation for the separatrices, but it is late and I want to go home. Do a Google search for separatrices:

http://www.google.com/search?hl=en&q=separatrices&btnG=Google+Search. Interesting stuff.