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.

112 CHAPTER 3. LINEAR ODE MODELS<br />

case, the assumptions are determined by trial and error, i.e., looking at the<br />

form of the answer, which is now given.<br />

Methods for ¯rst order ODEs:<br />

| Trying classi¯cation methods |<br />

trying a quadrature<br />

trying 1st order linear<br />

< ¡t<br />

e<br />

( RC<br />

>:<br />

)μ<br />

P + AC¼¿R2<br />

¿ 2 + ¼ 2 R 2 C 2<br />

AC¼¿R<br />

¡<br />

2 μ <br />

¼t<br />

cos<br />

¿<br />

¿ 2 + ¼2R2C 2 +<br />

AR¿ 2 μ <br />

¼t<br />

sin<br />

¿<br />

¿ 2 + ¼2R2 ; t · ¿<br />

C2 8<br />

<<br />

AC¼¿R<br />

:<br />

2 ¿¡t<br />

e<br />

( RC )<br />

¿ 2 + ¼2R2 ¡t<br />

+ e( RC<br />

C2 )μ<br />

P + AC¼¿R2<br />

¿ 2 + ¼2R2C 2<br />

<br />

; t · T<br />

¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢<br />

Intheabovesolution,wehaveshownonlytheanalyticform(thusthedots)<br />

for the ¯rst cycle to save on text space. You can observe the complete solution<br />

by executing the recipe on your computer. Because of the inclusion of the<br />

infolevel[dsolve] command, we are told in the output that Maple recognizes<br />

ode3 as a ¯rst-order linear ODE and presumably uses a standard method for<br />

solving such an ODE. You may object to this \black box" nature of the dsolve<br />

command, but obtaining the answer easily in our opinion is more important<br />

than the mechanical details leading up to it. However, if the methodology is<br />

important to you, we shall mimic a hand calculation in the next recipe.<br />

To make a plot, we shall take the parameter values1 to be T = 1 second (60<br />

heartbeats per minute), ¿ =0:15 s, C =0:002 liters/mm Hg, P =80mmHg,<br />

and R = 1056 mm Hg/liter/second.<br />

> tau:=0.15: T:=1: C:=0.002: P:=80: R:=1056:<br />

The amplitude parameter A must be such that the right-hand side (rhs) of the<br />

solution must be the same at t = T as at t = 0, i.e., the heartbeat is periodic.<br />

> eq:=eval(rhs(sol),t=0)=eval(rhs(sol),t=T);<br />

432:0593387 A¼<br />

eq := 80: =<br />

+49:82624166<br />

0:0225 + 4:46054400 ¼2 The above equation is numerically solved for A.<br />

> A:=fsolve(eq,A);<br />

A := 0:9791418590<br />

The pressure is then given by the rhs of sol, the °oating-point evaluation commandbeingusedtoexpresstheanswertofourdigits.<br />

> Pressure:=evalf(rhs(sol),4);<br />

1These approximate values are taken from the Internet.

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

Saved successfully!

Ooh no, something went wrong!