16.12.2012 Views

Computer Algebra Recipes

Computer Algebra Recipes

Computer Algebra Recipes

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

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

Using the BDA for the time derivative to connect time step n to the previous<br />

step n ¡ 1 and approximating the rhs with its value at step n, thebackward<br />

Euler approximation to equations (2.19) is<br />

xn ¡ xn¡1<br />

h<br />

= Xn; yn ¡ yn¡1<br />

h<br />

= Yn;<br />

zn ¡ zn¡1<br />

h<br />

= Zn;<br />

or letting n ! n + 1 and substituting the forms of X, Y ,andZ,<br />

xn+1 = xn + h (a ¡ b) xn+1 ¡ hgNn+1 xn+1 ¡ h¯xn+1 zn+1<br />

yn+1 = yn + h¯xn+1 zn+1 ¡ h (¾ + b) yn+1 ¡ hgNn+1 yn+1<br />

zn+1 = zn + h¾yn+1 ¡ h (® + b) zn+1 ¡ hgNn+1 zn+1<br />

(2.20)<br />

with Nn+1 = xn+1 + yn+1 + zn+1.<br />

This algorithm is nonlinear in the unknowns xn+1, yn+1, andzn+1, andis<br />

an example of an implicit algorithm because one cannot explicitly express the<br />

unknowns in terms of the known values xn, yn, andzn. The standard approach<br />

is to make the scheme semi-implicit by linearizing it as follows. For a nonlinear<br />

function f(xn+1; zn+1), we Taylor expand thus:<br />

μ <br />

μ <br />

@f<br />

@f<br />

f(xn+1;zn+1) =f(xn;zn)+(xn+1¡xn)<br />

+(zn+1¡zn)<br />

+¢¢¢<br />

@x<br />

@z<br />

xn;zn<br />

xn;zn<br />

For our fox-rabies example, this gives us, for example,<br />

f ´ (xz) n+1 = xn zn + zn(xn+1 ¡ xn)+xn(zn+1 ¡ zn): (2.21)<br />

Applying this procedure to all of the quadratic terms on the rhs of (2.20) and<br />

gathering all the \new" values xn+1, etc.,onthelhs,weobtain<br />

with<br />

A1n xn+1 + B1n yn+1 + C1n zn+1 = xn + D1n;<br />

A2n xn+1 + B2n yn+1 + C2n zn+1 = yn + D2n;<br />

A3n xn+1 + B3n yn+1 + C3n zn+1 = zn + D3n;<br />

(2.22)<br />

A1n =1+h (b ¡ a)+hg(Nn + xn)+h¯zn; B1n =hgxn; C1n =h (¯ + g) xn;<br />

A2n =hgyn ¡ h¯zn; B2n =1+h (¾ + b)+hg(Nn + yn); C2n =hgyn ¡ h¯xn;<br />

A3n =hgzn; B3n =hgzn ¡ h¾; C3n =1+h (® + b)+hg(Nn + zn);<br />

D1n =hgNn xn + h¯xn zn; D2n =hgNn yn ¡ h¯xn zn; D3n =hgNn zn:<br />

We now have three linear equations (2.22), with known numerical coe±cients<br />

determined from the previous step, for the three unknowns xn+1, yn+1, zn+1.

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

Saved successfully!

Ooh no, something went wrong!