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.

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

and you should feel free to experiment with di®erent positive values.<br />

> A[1]:=2: A[2]:=1: B[1]:=3/100: B[2]:=1/100:<br />

The nonlinear functions P =A1 r ¡ B1 rf and Q=¡A2 f + B2 rf, corresponding<br />

to the right-hand sides of the ODEs in (2.10), are entered as \functional<br />

operators" using the \arrow notation."<br />

> P:=(r,f)-> A[1]*r-B[1]*r*f;<br />

P := (r; f ) ! A1 r ¡ B1 rf<br />

> Q:=(r,f)-> -A[2]*f+B[2]*r*f;<br />

Q := (r; f) !¡A2f + B2 rf<br />

The \arrow" (->) in the above inputs is formed on the keyboard by entering a<br />

\hyphen" followed by a \greater than" sign. The operation or \procedure" on<br />

the right-hand side of each arrow will be applied when the two3 variables r and<br />

f on the left-hand side are supplied as arguments to P and Q. For example,<br />

let's take r =100andf =10andcalculateP (100; 10).<br />

> P(100,10); #example<br />

170<br />

The procedure on the rhs of P has been applied with the coe±cient values<br />

automatically substituted, namely, 2 £ 100 ¡ (3=100) £ 100 £ 10 = 170.<br />

To classify the stationary points, we need to evaluate a, b, c, andd, which<br />

respectively involve the partial derivatives @P=@r, @P=@f, @Q=@r, and@Q=@f<br />

evaluated at the stationary points. A functional operator F is introduced to<br />

di®erentiate an arbitrary quantity X(r; f ) with respect to a variable v.<br />

> F:=(X,v)->diff(X(r,f),v):<br />

Then F is used to calculate the four relevant partial derivatives of P and Q.<br />

> a:=F(P,r): b:=F(P,f): c:=F(Q,r): d:=F(Q,f):<br />

The results have been labeled a, b, c, andd, but remember that the derivatives<br />

must still be evaluated at each stationary point. So let's locate the stationary<br />

points by solving P (r; f) =0andQ(r; f)=0forr and f.<br />

> sol:=solve(fP(r,f)=0,Q(r,f)=0g,fr,fg);<br />

½<br />

sol := fr =0;f=0g; f = 200<br />

3 ;r=100<br />

¾<br />

There are two ¯xed points, one at the origin (r =0, f = 0) and the second at<br />

r =100, f =200=3=662. By choosing one of the ¯xed points and assigning the<br />

3<br />

solution, the coordinates will automatically be substituted into the expressions<br />

that follow. Let's select the nonzero ¯xed point, which is the second solution<br />

here. As a check, the coordinates r0 and f0 of the ¯xed point are displayed.<br />

> assign(sol[2]); r0:=r; f0:=f;<br />

r0 := 100 f0 := 200<br />

3<br />

Then the values of a, b, c, anddare determined for the assigned ¯xed point.<br />

3 Any (¯nite) number of variables may be used.

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

Saved successfully!

Ooh no, something went wrong!