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.

2.1. PHASE-PLANE ANALYSIS 53<br />

> a:=a; b:=b; c:=c; d:=d;<br />

a := 0 b := ¡3 c := 2<br />

d := 0<br />

3<br />

The quantities p = ¡(a + d) andq = ad¡ bc are calculated.<br />

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

p := 0 q := 2<br />

Referring to Figure 2.1, these values of p and q indicate that the stationary<br />

point must be either a vortex or a focal point. Instead of always referring<br />

back to the p-q picture in the text when tackling other examples, it is more<br />

convenient to create the picture directly in the code and place the (q, p) point<br />

on it. The range of q and p in the ¯gure will be set to be from R = ¡3 to<br />

+3. For other stationary-point problems, this range may have to be adjusted.<br />

Further, the display command will be used to superimpose a number of graphs<br />

in the same ¯gure. This command is found in the plots library package, which<br />

is now loaded.<br />

> R:=3: with(plots):<br />

The ¯rst graph, assigned the name gr1, usesthepointplot command to plot<br />

the point (q, p) (entered as a list) as a size-20 blue box. The default size is 10.<br />

> gr1:=pointplot([q,p],symbol=box,symbolsize=20,color=blue):<br />

The second graph, gr2, plotsthetwobranchesp = § p 4 q of the parabola that<br />

divides the focal point and nodal point regions in the p-q diagram. Note that<br />

q is entered as qq (which ranges from ¡R to R), because q has already been<br />

assigned a speci¯c value. The resulting parabola is represented by a thick (the<br />

default thickness is 0) red curve on the computer screen. The minimum number<br />

of plotting points is taken to be 250, the default being 50.<br />

> gr2:=plot([sqrt(4*qq),-sqrt(4*qq)],qq=-R..R,<br />

numpoints=250,thickness=2,color=red):<br />

The third graph, gr3, generates a thick green line along the p=0 axis between<br />

q =0 andq =R and along the q =0 axis between p=¡R and p=+R.<br />

> gr3:=plot([[[0,0],[R,0]],[[0,-R],[0,R]]],style=line,<br />

color=green,thickness=3):<br />

Using the textplot command, the fourth graph labels the various regions of<br />

the p-q diagram. Here sFP stands for stable Focal Point, uFP for unstable Focal<br />

Point, sNP for stable Nodal Point, uNP for unstable Nodal Point, SP for Saddle<br />

Point, and V and FP for Vortices and Focal Points. The two numbers in each<br />

list are determined by trial and error and indicate the horizontal and vertical<br />

locations of each string of letters.<br />

> gr4:=textplot([[1,0.9,"sFP"],[1,-0.9,"uFP"],<br />

[0.7,2.5,"sNP"],[0.7,-2.5,"uNP"],[-1,0.8,"SP"],<br />

[-1,-0.8,"SP"],[1,0.2,"V and FP "]]):<br />

All four graphs are superimposed with the display command, the axes being<br />

labeled, and the minimum number of tickmarks along each axis speci¯ed.<br />

> display(fgr1,gr2,gr3,gr4g,labels=["q","p"],tickmarks=[3,3]);

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

Saved successfully!

Ooh no, something went wrong!