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.

124 CHAPTER 3. LINEAR ODE MODELS<br />

The sine and cosine terms in the solution survive as t ! 1 and represent<br />

the steady-state parts, while the exponential terms decay to zero and thus<br />

correspond to the transient parts of the solution. The summation is over the four<br />

roots of the quartic polynomial given in the subexpression %1. To manipulate<br />

the solution further, it is now assigned.<br />

> assign(sol):<br />

Using the remove command, the exponential terms are removed from x1(t) and<br />

x2(t) to yield the steady-state parts, x1ss and x2ss, separately.<br />

> x1ss:=remove(has,x1(t),exp); x2ss:=remove(has,x2(t),exp);<br />

x1ss := 36<br />

26<br />

228<br />

cos(2 t)+ sin(2 t) x2ss := ¡164 cos(2 t) ¡ sin(2 t)<br />

493 493 493 493<br />

The select command is used to extract the exponential terms from x1(t) and<br />

x2(t), thus producing the transient parts separately.<br />

> x1tr:=select(has,x1(t),exp): x2tr:=select(has,x2(t),exp):<br />

Because the roots of a quartic polynomial must be found, the numerical °oatingpoint<br />

evaluation command is applied to each of the transient parts. The complex<br />

evaluation command is then used to simplify the outputs, which are given<br />

by x1tr and x2tr.<br />

> x1tr:=evalc(evalf(x1tr)); x2tr:=evalc(evalf(x2tr));<br />

x1tr := 0:5591296681 e (¡0:3923340189 t) cos(0:3903466128 t)<br />

+0:9914981558 e (¡0:3923340189 t) sin(0:3903466128 t)<br />

+0:3678480196 e (¡0:3576659811 t) cos(1:226572647 t)<br />

¡ 0:1154210539 e (¡0:3576659811 t) sin(1:226572647 t)<br />

x2tr := 0:6802842310 e (¡0:3923340189 t) cos(0:3903466128 t)<br />

+1:721342502 e (¡0:3923340189 t) sin(0:3903466128 t)<br />

¡ 0:3476270302 e (¡0:3576659811 t) cos(1:226572647 t)<br />

+0:3225193055 e (¡0:3576659811 t) sin(1:226572647 t)<br />

You might have thought our earlier identi¯cation of the exponential terms as<br />

the transient contribution a bit premature, but now one can clearly see that<br />

they decay to zero as t goes to in¯nity.<br />

The steady-state and transient contributions are now plotted separately.<br />

Lists are used here so that the steady-state and transient parts of x1(t) are<br />

colored red on the computer screen, while the corresponding parts for x2(t) are<br />

colored blue.<br />

> plot([x1ss,x2ss],t=0..20,color=[red,blue],tickmarks=[3,4]);<br />

> plot([x1tr,x2tr],t=0..20,color=[red,blue],tickmarks=[3,4]);<br />

The black-and-white versions of the two pictures are shown in Figure 3.4, the<br />

steady-state contributions on the left, the transient contributions on the right.

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

Saved successfully!

Ooh no, something went wrong!