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.

116 CHAPTER 3. LINEAR ODE MODELS<br />

( t (t¡2)<br />

IF := (1 + t) e 2 )<br />

With the integrating factor known, the standard mathematical procedure is to<br />

multiply ode by IF and integrate. This is easily accomplished with the ¯rst<br />

integral (firint) command.<br />

> sol1:=firint(ode*IF);<br />

μ<br />

<br />

t (t¡2) t (t¡2)<br />

sol1 := e<br />

( ) 2 + e<br />

( ) 2 t v(t) ¡ 3 te (1=2 t2 ¡ 2 t) ¡ 4 e (1=2 t2 ¡ 2 t)<br />

+ 5<br />

2 I p ¼e (¡2) p μ<br />

1<br />

2erf<br />

2 I p 2 t ¡ p <br />

2 I ¡ t2 e (1=2 t2 ¡ 2 t) + C1 =0<br />

In the solution output, I stands for p ¡1, erf for the error function, 3 and C1<br />

is the integration constant to be determined. Then, sol1 is solved for v(t), the<br />

result (assigned the name V ) not being shown here in the text.<br />

> V:=solve(sol1,v(t));<br />

Evil Knievel's initial velocity is zero. So the constant C1 is determined by<br />

evaluating the velocity V at t = 0, equating the result to 0, and solving for<br />

C1 . The constant will be automatically substituted into V .<br />

> _C1:=solve(eval(V,t=0)=0,_C1);<br />

C1 := 4 + 5<br />

2 I p ¼e (¡2) p 2erf( p 2 I)<br />

On simplifying V , Evil Knievel's velocity is now determined at arbitrary time<br />

t ¸ 0. This is a nontrivial result to derive by hand.<br />

> Vel:=simplify(V);<br />

Vel := 1<br />

μ<br />

6 te<br />

2<br />

+2t 2 e<br />

t (t¡4)<br />

( 2<br />

t (t¡4)<br />

( 2<br />

) +8e (<br />

t (t¡4)<br />

2 ) p (¡2) ¡ 5 I ¼e p μ<br />

1<br />

2erf<br />

) p<br />

¡ 8 ¡ 5 I ¼e (¡2) p 2erf( p <br />

2 I) e<br />

2 I p 2 t ¡ p <br />

2 I<br />

t (t¡2)<br />

(¡ 2<br />

) ± (1 + t)<br />

Now, since the original ODE was completely real, the velocity must also be<br />

completely real. It can be converted to a real form using the Re (real part of)<br />

command, assuming that t>0. The new function er¯ is the imaginary error<br />

function, 4 which is a real function here.<br />

> Vel:=Re(Vel) assuming t>0;<br />

Vel := 1<br />

Ã<br />

6 te<br />

2<br />

+2t 2 e<br />

t (t¡4)<br />

( 2<br />

t (t¡4)<br />

( 2<br />

R<br />

3 2 u<br />

De¯ned as erf(u) = p¼<br />

) +8e (<br />

t (t¡4)<br />

2 ) p (¡2) +5 ¼e p à p<br />

2 t<br />

2er¯<br />

) p (¡2) ¡ 8+5 ¼e p 2er¯( p <br />

2) e<br />

0 e¡t2<br />

dt:<br />

4 De¯ned as er¯(u) =¡I erf(Iu)= 2<br />

p¼<br />

R u<br />

0 et2<br />

dt.<br />

t (t¡2)<br />

(¡ 2<br />

2 ¡ p 2<br />

!<br />

) ± (1 + t)

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

Saved successfully!

Ooh no, something went wrong!