16.12.2012 Views

Computer Algebra Recipes

Computer Algebra Recipes

Computer Algebra Recipes

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

70 CHAPTER 2. PHASE-PLANE ANALYSIS<br />

> sol:=solve(fP,Qg,fx,yg);<br />

sol := fx =0;y=0g; fy =0;x=1g; fy =0;x=1g<br />

yields the expected root at the origin and the twofold degenerate root (x =1,<br />

y = 0). Since we already know that the former is a vortex, let's select the<br />

second (or third) solution and assign it for later use.<br />

> assign(sol[2]);<br />

Then, calculating p and q using the standard formulas,<br />

> p:=-(a+d); q:=a*d-b*c;<br />

p := ¡1 q := 0<br />

we obtain p = ¡1 andq =0. Sinceqis zero, the degenerate root is a higherorder<br />

stationary point as I predicted."<br />

\OK, I understand your construction of a higher-order ¯xed point. But what<br />

do the trajectories look like in the phase plane, and how does the displacement<br />

x(t) behave in this case?"<br />

\To answer your questions, I ¯rst have to unassign x and y from their<br />

stationary-point values,<br />

> unassign('x','y');<br />

and then enter the associated ¯rst-order ODEs.<br />

> ODEs:=fdiff(x(t),t)=y(t),diff(y(t),t)=-x(t)+2*x(t)^2-x(t)^3g;<br />

ODEs :=<br />

½<br />

d<br />

d<br />

x(t) =y(t);<br />

dt dt y(t) =¡x(t)+2x(t)2 ¡ x (t) 3<br />

¾<br />

In order to put the stationary points in the phase-plane diagram, let's create a<br />

plot for the two points, using size-20 red circles to represent their locations.<br />

> gr1:=plot([[0,0],[1,0]],style=point,symbol=circle,<br />

symbolsize=20,color=red):<br />

Employing the DEplot command, we can produce a phase-plane portrait for<br />

di®erent initial conditions."<br />

After some experimentation, Mike comes up with four di®erent initial conditions,<br />

which are included in the following DEplot command line. He chooses<br />

blue arrows with two barbs on the head (using arrows=MEDIUM) for the tangent<br />

¯eld and colors the trajectories red with the linecolor option. The time range<br />

is taken from t = 0 to 20 and the time step size equal to 0:05.<br />

> gr2:=DEplot(ODEs,[x(t),y(t)],t=0..20,x(t)=-1..2.5,<br />

y(t)=-1.5..1.5,[[x(0)=-0.4,y(0)=1],[x(0)=-0.35,y(0)=0],<br />

[x(0)=-0.3,y(0)=0],[x(0)=-0.2,y(0)=0]],stepsize=0.05,<br />

color=blue,linecolor=red,arrows=MEDIUM,dirgrid=[20,20]):<br />

Putting the two graphs gr1 and gr2 together with the display command<br />

> display(fgr1,gr2g,tickmarks=[2,3]);<br />

and controlling the tick marks on the coordinate axes results in the phase portrait<br />

shown in Figure 2.13. The four trajectories, corresponding to the four<br />

initial conditions, are clearly seen.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!