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.

262 CHAPTER 6. LINEAR PDE MODELS. PART 2<br />

that vanishes at x = 1 is de¯ned as<br />

r Z 1<br />

2<br />

FST (f(x)) ´ F (s) = f(x)sin(sx) dx; (6.5)<br />

¼ 0<br />

and the inverse Fourier sine transform of F (s) by<br />

r Z 1<br />

2<br />

f(x) = F (s)sin(sx) ds: (6.6)<br />

¼ 0<br />

For the present problem, the temperature distribution will satisfy the onedimensional<br />

heat di®usion equation (with d the heat di®usion coe±cient),<br />

@T(x; t)<br />

= d<br />

@t<br />

@2T (x; t)<br />

@x2 : (6.7)<br />

Taking the FST of (6.7) with respect to x and integrating the rhs twice by parts,<br />

and assuming f 0 (x !1) ! 0, will convert the PDE into a ¯rst-order ODE for<br />

the transformed quantity F (s; t). The ODE will depend on the boundary condition<br />

T (0;t). The ODE is then solved for F (s; t) making use of the Fourier sine<br />

transform of the initial condition. Finally, on performing the inverse transform<br />

with respect to s, the temperature distribution T (x; t) is found.<br />

Once again, Vectoria disdains doing the problem \the old-fashioned way"<br />

favored by some instructors, but instead intends to let the computer assist her.<br />

To this end, she loads the plots and integral transform packages,<br />

> restart: with(plots): with(inttrans):<br />

and enters the di®usion equation DE,<br />

> DE:=diff(T(x,t),t)=d*diff(T(x,t),x,x);<br />

DE := @ T (x; t) =d<br />

@t<br />

μ<br />

@ 2<br />

2 T (x; t)<br />

@x<br />

and the boundary condition T (0;t)=T0.<br />

> T(0,t):=T0:<br />

To keep the recipe general for the moment, Vectoria has not yet speci¯ed the<br />

value of T0 . She then takes the FST of DE with respect to x, the integration<br />

by parts and boundary condition substitution being automatically done.<br />

> FST:=fouriersin(DE,x,s);<br />

FST := @<br />

@t fouriersin(T (x; t);x;s)=ds(p 2 T0 ¡ s fouriersin(T (x; t);x;s) p ¼)<br />

p<br />

¼<br />

To simplify the notation and facilitate solving the above ODE, she replaces<br />

fouriersin(T (x; t);x;s)withF (t), temporarily suppressing the argument s.<br />

> FST:=subs(fouriersin(T(x,t),x,s)=F(t),FST);<br />

FST := d<br />

dt F (t) = ds(p2 T0 ¡ s F (t) p ¼)<br />

p<br />

¼<br />

The Fourier sine transform of the initial condition is zero, so Vectoria solves<br />

the ¯rst-order linear di®erential equation FST for F (t), subject to F (0) = 0.<br />

> eq:=dsolve(fFST,F(0)=0g,F(t));

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

Saved successfully!

Ooh no, something went wrong!